How to move text in css

藏色散人
Release: 2022-12-30 11:11:58
Original
9953 people have browsed it

How to move text in css: 1. In the block element container, you can use "text-align: center, left, right" to move the position of the text; 2. Use float and padding attributes; 3. Text movement is achieved through position positioning.

How to move text in css

The operating environment of this tutorial: windows7 system, css3 version, Dell G3 computer.

Recommended: css video tutorial

css moving text

First, you can use a container to wrap the text, giving the width and high.

Then, you can use a variety of methods to move the text:

1. If it is in a block element container, you can use text-align: center, left, right to move the position of the text.

2. You can use float

3. You can use padding

4. Use position positioning

First set position: relative on the parent element; then Set the position in the container you need to move: absolute; the top, left, right, and bottom directions should be as many px as possible

For example:

body{
width:900px;
height:600px;
position:relative;
}
div(这里是你要移动的容器){
width:200px;
height:123px;
position:absolute;
top:10px;
left:5px;
}
Copy after login

5. If it is in an inline element container , you can use text-indent: 15px; (This is the indent of the paragraph. You can use two indents in front of the paragraph)

The above is the detailed content of How to move text in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template