- From: Ron van den Boogaard <ron@ronvdb.com>
- Date: Thu, 17 Apr 2014 18:11:54 +0200
- To: François REMY <francois.remy.dev@outlook.com>
- Cc: CSS WG <www-style@w3.org>
As an author, to me this feels more like a hack than a solution.
Using !important is considered bad practice where I am living anyway.
Ron van den Boogaard
On 17 apr. 2014, at 17:57, François REMY <francois.remy.dev@outlook.com> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>
> EDIT: forgot to add "!important" to the generic declaration to make it happen before all the other rules
>>>>>>>>>>>>>>>>>>>>>>>>
>
> Hi,
>
> Just figured out I would have liked to have “cascade” today in the following
> case:
>
> button {
> background: #aaa;
> color: black;
> }
>
> button:hover {
> background: orange;
> color: white;
> }
>
> <!-- this button won't become orange on hover :( -->
> <button style="background: red; color: white;">...</button><!-- or
> #button_id { ... } -->
>
> vs
>
>
> :hover {
> background: var(--hover-background, cascade) !important;
> color: var(--hover-color, cascade) !important;
> }
>
> button {
> background: #aaa;
> --hover-background: orange;
> color: black;
> --hover-color: white;
> }
>
> <!-- it will work :-) -->
> <button style="background: red; color: white;">...</button><!-- or
> #button_id { ... } -->
>
> That's it, this is just for the record and possible later references --
> except if you have comments of course!
> François
>
> ______________________
> PS: Yes, I know, I can maybe use "button:hover" and accept only
> "--hover-background" for buttons, for which I know what the fallback should
> be, but that's maybe not the most elegant option, or is it? What if I don't
> want to change the background if no hover-background was specified?
>
>
>
>
Received on Thursday, 17 April 2014 16:12:33 UTC