Home  >  Article  >  Web Front-end  >  CSS positioning: relative positioning, absolute positioning and fixed positioning (relative absolute fixed)

CSS positioning: relative positioning, absolute positioning and fixed positioning (relative absolute fixed)

WBOY
WBOYOriginal
2016-08-18 08:57:581317browse

Relative positioning: position:relative;

 Does not break away from the document flow, refers to its own static position through top, bottom, left, right positioning, and can be hierarchically graded through z-index.

Absolute positioning: position:absolute;

  Break away from the document flow, position through top, bottom, left, right, and select its nearest parent element for positioning. When the position of the parent element is static, the absolute element will be positioned at the origin of the body coordinates, which can be positioned through the x-index level Grading.

Fixed positioning: position:fixed;

 The object he fixed here is the visual window instead of the body, or the parent element, which can be hierarchically graded through z-index.

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