Home  >  Article  >  Web Front-end  >  "margin:0 atuo;" What does it mean?

"margin:0 atuo;" What does it mean?

Guanhui
GuanhuiOriginal
2020-05-29 15:26:295026browse

What does "margin:0 atuo;" mean?

"margin:0 atuo;" means horizontal centering. If there are only two parameters after margin, the first one represents top and bottom, and the second one represents left and right, and because the upper and lower boundaries are 0, and the left and right edges adapt to the same value according to the width, the expression means horizontal centering.

CSS horizontal centering method

Inline elements:

Inline elements are inline elements. For example, 45a2772a6b6107b401db3c9b82c049c2, 3499910bf9dac5ae3c52d5ede7383485, 2e1cf0710519d5598b1f0f14c36ba674, 907fae80ddef53131f3292ee4f81644b, a1f02c36ba31691bcfe87b2722de723b, etc. .

Directly build a container with the "text-align:center" style, then all the inline elements contained in it will be centered.

 <div style="text-align:center;border-style:solid">
        <p style="border-style:solid;width:500px">我是块级元素,我不居中</p>
        <span style="border-style:solid">我是行内元素,我要居中</span>
    </div>

Block-level elements:

Block-level elements are: div, p, form, ul, li, ol, dl, form, address, fieldset, hr, menu, table

Fixed width is actually easy to solve. Simply use margin:0 auto to center the container, and add text-align:center to center the text.

<p style="border-style:solid;text-align:center;margin:0 auto;width:500px">我是定宽块级元素,我要居中</p>

Recommended tutorial: "CSS Tutorial"



The above is the detailed content of "margin:0 atuo;" What does it mean?. 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