Home >Web Front-end >CSS Tutorial >How to move words to the right in css
In CSS, you can use the transform attribute and the "translateX()" function to move the text to the right. The "translateX()" function is used to define the position of the element when it is translated left and right. You only need to add The "transform:translateX (move value to the right)" style is enough.
The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.
How to move words to the right in css
In css, you can use the transform attribute and the "translateX()" function to move the words to the right tune. The transform property applies a 2D or 3D transformation to an element. This property allows us to rotate, scale, move or tilt the element.
translateX(x) defines the transformation, just using the X-axis value.
The example is as follows:
<!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> .p2{ transform:translateX(10px); } </style> </head> <body> <p class="p1">这是一段文本</p> <p class="p2">这也是一段文本</p> </body> </html>
Output result:
(Learning video sharing: css video tutorial)
The above is the detailed content of How to move words to the right in css. For more information, please follow other related articles on the PHP Chinese website!