Home > Web Front-end > CSS Tutorial > What are the positioning positions in css?

What are the positioning positions in css?

王林
Release: 2020-11-20 09:20:42
Original
2479 people have browsed it

The positioning of position in css is: 1. static; 2. fixed; 3. relative; 4. absolute. Static is equivalent to no positioning, and relative generates relatively positioned elements.

What are the positioning positions in css?

There are four values ​​for position in css, namely static, fixed, relative, and absolute.

(Learning video tutorial: css video tutorial)

Detailed introduction:

  • static: equivalent to no positioning, element will appear in the normal document flow.

  • fixed: The element box behaves like absolute, but fixed is positioned relative to the view window itself, that is, the browser window. Therefore, when the element with this positioning is scrolled down on the page, its position will not change.

  • relative: Generate a relatively positioned element, which is positioned relative to the position of the element itself, and the space it originally occupied will still be retained.

  • absolute: Generate an absolutely positioned element and position it relative to the first positioned ancestor element other than static positioning. Since static positioning is equivalent to no positioning, absolute positioning is actually positioned relative to the first positioned ancestor element. If all ancestor elements are not positioned, it will be positioned relative to the initial containing block or canvas, usually the body element.

Related recommendations: CSS tutorial

The above is the detailed content of What are the positioning positions in css?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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