Separate conditions depending on children
How do i specify separate conditions if element has different children?
For example - if a
.button
only has .icon
- set the aspect-ratio
to 1/1
, if it has .icon
and .text
- unset
the aspect-ratio
and set the width
to 100%
19 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
i use scss
you seem to modify the children, but the point is to modify the parent
You can use the new :has() selector (but it does not have full support yet on all browsers)
i tried using has but got stuck on if it can pull out multiple elements or not
can you make a small example of what you have (html,css) of the button
preferably codepen
should be
here simple example of has.
if the .button has a .text, style the .button with color:red
it works multiple levels down
🤔
here's a solution w/o has (+1 class)
no idea what your end result should look like.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
not really (the height is too large)
that you can do yourself. i saw 8px padding (0.5rem) and a height of 40px (2.5rem) for the icon. together that is what i have
and ideally if you add more icon buttons they should bump the regular button until it can't scale anymore
that it will