- Special features of positioning
1. Add to inline elements,绝对定位
you can directly set the width and height
2. Add to block-level elements绝对定位
If the width and height are not set to the size of the text (inline elements)
floating elements, absolute positioning (fixed positioning) will not trigger Outer margin merge collapse problem (out of standard)
Floating elements will only hold down the box below the element and will not cover the content.
Absolute positioning will hold down the box and the text
floating will not hold down the text because the purpose of floating is to create a text wrapping effect. The text will surround the floating element.
If there is both left and right in a box, left will be executed first, and
top will be executed first in the same way as bottom.
- The display and hiding of the element
display
display :none;
display element
display:block;
hide element hide element
does not occupy the original position after hiding the element
visibility
visibility: hidden;
hide element
visibility: visible;
display element display element
continues to occupy the original position after hiding
overflow
overflow: visible;
overflow: hidden;
cut the content beyond the set element
overflow: scroll;
** Whether the content exceeds the
overflow: auto;
content, the scroll bar content is always displayed The scroll bar will be displayed if it is exceeded, it will not be displayed if it is exceeded