0

So I was looking at the code for a nav bar someone shared on another site that I really liked. He had some things in his CSS that I didn’t fully understand.

*,
*::before,
*::after {
     box-sizing: border-box;
}
html,
body {
     height: 100%;
}

So I have a couple questions. First wouldn’t * include everything everything? What would *::before and *::after include that wouldn’t be part of everything already?

Also similar question. Wouldn’t assigning html’s height to 100% also set body’s height to 100% since it’s a child of html?

Thanks in advance for any help

  • 3
    `*` selects all _elements_, regardless of tag name, but not _pseudo_ elements. – CBroe Jan 04 '21 at 13:42
  • 3
    _“Wouldn’t assigning html’s height to 100% also set body’s height to 100% since it’s a child of html?”_ - no, because height is not an _inherited_ property. https://developer.mozilla.org/en-US/docs/Web/CSS/inheritance – CBroe Jan 04 '21 at 13:42
  • "Also similar question." Please avoid combining two questions into one. You can only accept one and questions are more useful to others when they are focused – Ruan Mendes Jan 04 '21 at 13:47

0 Answers0