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.
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!