Ich habe das folgende scss Ausschnitt. Wenn .child
vorhanden ist, möchte ich die .container
eine Farbe von yellow
habe ich Code an anderer Stelle haben, die mit .child
auf sie das Element entfernt fügt/entferntSCSS Stil Eltern nur, solange Kind anwesend ist
.container {
height: 100%;
color: red;
:global {
.child {
background-color: black;
}
.container .child { <=== This obviously doesn't work but
I need .container to be yellow only when child is present
color: yellow;
}
}
}
Wie gebe ich, dass in SCSS?
Mögliches Duplikat von [Gibt es einen CSS-Elternselektor?] (Https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector) – Quentin