CSS positioning and scroll bar

0805 self-summary

一.Absolute positioning

position: absolute;

/*Absolute positioning: 1. Positioning attribute value: absolute 2. It no longer occupies a place in the page (floating), and cannot inherit the width of the parent (you must Custom width) 3. Once positioned, the positioning layout position top, bottom, left, right can participate in the layout 4. The reference system of absolute positioning is the nearest positioning parent (not which point in the parent, but the four sides) (Refer to the four sides) 5. Left and right exist at the same time, take the left; in the same way, take the upper and lower positions. 6. When the parent is positioned, the child is positioned with reference to the parent, and the parent width can be retrieved (or the parent height can also be obtained in the calculation. )*/

position:fixed

Generate absolutely positioned elements and position them relative to the browser window.

Two. Relative positioning

position: relative;

Parent (the nearest Parent) The purpose of relative positioning

1) Does not affect its own layout

2) Assists in its absolute positioning layout

Three default Positioning

position: static

The default value. Without positioning, the element appears in the normal flow (ignoring top, bottom, left, right or z-index declarations).

Four. Inherited positioning

position:inherit

Specifies that position should be inherited from the parent element The value of the attribute.

Five.Scrollbar

overflow

  • hidden: no scroll bar, And the content is only the content of the specified area.
  • visible: The default value has no scroll bar. This attribute defines how the content of the overflow element content area will be processed and displayed.

  • < li>

    scroll: This attribute defines how the content of the overflow element content area will be handled. If the value is scroll, the user agent will provide a scrolling mechanism regardless of whether it is needed. Therefore, it is possible that scroll bars will appear even if all the content can be placed in the element box.

  • Auto: display the scroll bar, and the content is only the content of the specified area.

Leave a Comment

Your email address will not be published.