I have saw this code in sassscript but it does'nt make my sense and I'm unable to found any official documentation regarding the mention sasscript css output
SassScript
.main aside:hover,
.sidebar p {
parent-selector: &;
// => ((unquote(".main") unquote("aside:hover")),
// (unquote(".sidebar") unquote("p")))
}
CSS Output
.main aside:hover,
.sidebar p {
parent-selector: .main aside:hover, .sidebar p;
}
explain how this will work, in css. is this officially documented by w3c or not.
In standard CSS, there is no "
parent-selector" functionality. CSS primarily deals with selecting and styling elements based on their relationship to other elements, but it doesn't provide a way to select a parent based on the behavior of its children.So, this won't work:
Well pointed out, indeed, currently it is useless.
In the CSS Selectors Level 4 Working Draft introduced a new pseudo-class called
:has(), which allows us to select parent - which is currently not supported in all major browsers.In this example, it selects the
lielement that is a direct parent of theaelement with classactive.