CSS Grid Properties Not Extending Beyond First-Level Elements
When defining a CSS Grid on the top-most level of a nested list structure, you may encounter difficulties applying grid properties to elements nested deeper within the list. This issue arises due to the limited scope of CSS grid formatting contexts, which only extend between parents and their immediate children.
In the provided example, you've created a grid layout on the
with the class orgChartLevel1. You then tried to apply grid properties to - elements within a nested
(.orgChartLevel2b). However, these properties are not being applied because the nested - elements are descendants, not children, of the grid container.
Solution:
To apply grid properties to elements nested within a grid container, you must either:
- Assign display: grid or display: inline-grid to the parent element of the desired elements.
- Remove the intervening elements between the grid container and the elements you wish to apply grid properties to.
Note:
- Grid items can also be used as grid containers.
- Check the linked resources for further information on related topics.
The above is the detailed content of Why Aren't My CSS Grid Properties Affecting Nested List Elements?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn