79687874

Date: 2025-07-02 17:53:51
Score: 0.5
Natty:
Report link

What you’re observing is a common issue when combining CSS Grid layouts and shadow DOM, especially regarding how percentage heights are resolved.

The core problem:
In your .container class, you set height: 100%. For this to work, all ancestor elements—including your :host custom element—must have a defined height. However, setting only min-height on :host does not establish a definite height; it only sets a lower bound. As a result, .container (and its grid children) see their parent’s computed height as auto (i.e., undefined), so height: 100% collapses to zero.

Why does height: 0 “fix” it?
If you set height: 0 and combine it with min-height, browsers compute the element’s height as at least the min-height value. Now, the parent’s height is effectively known, and the grid’s height: 100% calculation produces the expected result. Without an explicit height, the reference point for height: 100% is missing.

Summary:

Possible solutions:

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): What you
  • Low reputation (1):
Posted by: janniskroeger