The default value of the overflow attribute is visible (overflow content is not processed, and the content may exceed the container.)
Because second you use fiexed positioning and fill the entire window, so you can't see even the overflow part. Only after adding overflow:auto|scroll, the scroll bar will appear if there is overflow.
Question 1: overflow:scroll The scroll bar will only appear when the block element specifies a fixed height and width. See demo: demo second does not have a fixed height and width. Its size is expanded by child elements, so overflow:scroll has no effect on it.
Question 2: third is positioned relative to second, not the current browser window. An absolutely positioned relative element is the most recently positioned parent element, or if there is none, it is relative to body.
absolute
Do not leave space for the element. Instead, position it at a specified position relative to its closest positioned ancestor or to the containing block. Absolutely positioned boxes can have margins, they do not collapse with any other margins.
I think the answer to question 1 should be:
Because
second
you usefiexed
positioning and fill the entire window, so you can't see even the overflow part. Only after addingoverflow:auto|scroll
, the scroll bar will appear if there is overflow.Question 1:
overflow:scroll
The scroll bar will only appear when the block element specifies a fixed height and width. See demo: demosecond
does not have a fixed height and width. Its size is expanded by child elements, sooverflow:scroll
has no effect on it.Question 2:
third
is positioned relative tosecond
, not the current browser window. An absolutely positioned relative element is the most recently positioned parent element, or if there is none, it is relative tobody
.position