-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An extra keyword to disable inheritance? #9531
Comments
what if |
This clashes with existing syntax, e.g list-style-position: outside;
list-style-image: none;
list-style-type: no-inherit; I'm also not convinced that your proposal is more readable and robust. |
It’s more readable in the sense that it contains the whole information in one declaration, that information being “set |
It's also not clear what kinds of inheritance this would avoid, e.g. <style>
div { color: cyan no-inherit }
</style>
<div>
<p>foo</p>
bar
</div> Presumably the intention would be for However, "bar" has a style of its own, that inherits from its parent element. There is also an anonymous block. So I guess And what about pseudo-elements? Presumably you want Just unsetting with an universal selector and desired pseudo-elements seems more straightforward and clear to me. |
As far as I know, there exist only one kind of inheritance in CSS. https://drafts.csswg.org/css-cascade/#inheriting
|
This would imply that "bar" wouldn't be cyan in the example above. Is that your intention? |
If that’s how inheritance works, then yes, “bar” would not be cyan. If Btw, |
Then this would be useless in most cases. |
From an author's point of view, the behavior of such a switch should be the same as not inherited properties work. Otherwise it would cause a lot of confusion. Sebastian |
The blog https://nerdy.dev/ has a transparent retractable sticky nav bar with a few buttons and links on the side. Since the bar is transparent, the website uses the following styles to allow the mouse cursor to go through the “empty” parts of the bar:
This works, but I think the code would be more readable and robust if we didn’t have to set and unset
none
in two steps. Imagine if there existed an optional keyword that disabled inheritance for a declaration.Does something like this exist?
The text was updated successfully, but these errors were encountered: