Home > Web Front-end > HTML Tutorial > Relative positioning and absolute positioning of DIV CSS positioning_html/css_WEB-ITnose

Relative positioning and absolute positioning of DIV CSS positioning_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:28:50
Original
1203 people have browsed it

In the process of CSS control typesetting, the layout is often messed up accidentally. In fact, you only need to understand the meaning of each method

Syntax
position: static | absolute | fixed | relative

They are static, absolute, fixed, relative

The more commonly used ones are absolute and relative

Absolute positioning (absolute): Drag the object assigned this positioning method out of the document flow, and use left, right, top, bottom and other attributes to perform absolute positioning relative to its closest parent object with the most positioning settings. , if the parent of the object does not set the positioning attribute, that is, it still follows the HTML positioning rules, it will be positioned based on the upper left corner of the body object as a reference. Absolutely positioned objects can be stacked, and the stacking order can be controlled through the z-index attribute. The z-index value is a unitless integer, with the larger one on top, and can have negative values ​​(currently negative values ​​are not supported by FF).

Relative positioning (relative): Objects cannot be stacked and are offset in the normal document flow based on left, right, top, bottom and other attributes. You can also use z-index hierarchical design.

After absolute is separated from the original parent object, its position will be filled by other objects, but relative will not

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