|
|
|
|
|
by dgb23
695 days ago
|
|
> With recent display roles (like grid, flex, contents, etc.) the HTML needed exclusively for layout problems is really minimized if not completely nonexistent. I'm not talking strictly about _problems_ but about requirements/relationships. Flex/grid describe parent/child relationships between elements. They inherently couple styling with structure, so that you are sometimes forced to introduce tags for stylistic grouping. > With `:has()` you can query "up" and "previous". :has() is a lookahead. Please correct me if I'm mistaken: But there are no selector rules that you can put on an element which looks up or at previous siblings that I know of. The only CSS features that query up/previous are @media and @container rules. |
|
And yes, you can select previous elements with :has(). Here is an article about it: https://tobiasahlin.com/blog/previous-sibling-css-has/