Home  >  Article  >  Web Front-end  >  How to rotate text direction 90 degrees with css

How to rotate text direction 90 degrees with css

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-05-20 17:06:248417browse

You can use the transform attribute in css to rotate the text direction by 90 degrees. The syntax format is "transform: rotate(90deg)". The transform attribute indicates that the element applies 2D or 3D transformation. When the value is rotate, it is rotated. A positive number is clockwise rotation, and a negative number is counterclockwise rotation.

How to rotate text direction 90 degrees with css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box {
            width: 20px;
            height: 30px;
            transform: rotate(90deg);
            -ms-transform: rotate(90deg);
            /* Internet Explorer 9*/
            -moz-transform: rotate(90deg);
            /* Firefox */
            -webkit-transform: rotate(90deg);
            /* Safari 和 Chrome */
            -o-transform: rotate(90deg);
            /* Opera */
        }
    </style>
</head>

<body>
    <p class="box">123</p>
</body>

</html>

Effect:

Original effect:

Recommended learning: css video Tutorial

The above is the detailed content of How to rotate text direction 90 degrees with css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn