Why I have to put content inside those divs in order to make them appear?
If I erase the word "content", the blue and red divs wont appear, why is that?
11 Replies
height: 100%
means 100% of the parent container, and by default all elements, including body
and html
, will only have enough height to fit their contents.
So, without any content, the div won't have any height, even though it has 100% of the parent, because there's no reason for the parent to have any height.
If you add you might find the behavior you're expectingThank you 🙂 I did added the line you told me to add and it worked, but the question is now, what is the default height of html and body? is it fit-content?
when adding height:100% to html and body, that's simply telling the internals "i want html and body to be as tall as the view port"?
if so, what is the parent of html and body, that they are taking measurements from, the view port?
Ah, I see the the default height of the body is 0
so 30% out of 0 is 0
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
if you want to have a footer stuck at the bottom of the visible screen, thats a good enough reason to change the height
plenty of reasons to change the default root height tbh
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
please provide an alternative solution instead of "revisit fundamentals" "that's not recommended"
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
@DanielFGray I still dont understand - if % takes value from the parent, and the default height of html is 0, that means the height of the body will be 0 if its set to 100%, and therefore the tag <c3> height will be 0px too if i set it to 10%, can you please clarify here?
Unknown User•17mo ago
Message Not Public
Sign In & Join Server To View