Home  >  Article  >  Web Front-end  >  How to move text in css

How to move text in css

藏色散人
藏色散人Original
2021-01-18 09:56:349963browse

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;
}

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!

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
Previous article:normalize.css How to useNext article:normalize.css How to use