- From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
- Date: Thu, 01 Mar 2018 20:21:24 +0000
- To: public-css-archive@w3.org
The [`!important` modifier](https://drafts.csswg.org/css-cascade/#importance) can be used in your stylesheet to indicate that certain styles should take precedence over inline styles. (Styles set by JQuery are usually inline styles; in vanilla JavaScript, inline styles are created by modifying the `style` property of the element object.) An `!important` priority is specified for each style property-value declaration: ```css [hidden] { visibility: hidden !important; /* regular inline styles can't make elements with a `hidden` attribute visible */ } ``` `!important` has been in CSS since the beginning, and is supported in all web browsers. But `!important` doesn't give you much nuance or control. Whenever possible it is better to work _with_ the JavaScript, adjusting the styles that it sets, instead of trying to override them separately. PS, One extra warning: you can also use `!important` in inline styles, or otherwise create `!important` priority styles from JavaScript. These then override `!important` in your stylesheet. But if a JavaScript library is using `!important` for styles that don't make sense on your website, you should probably reconsider using that JavaScript library. -- GitHub Notification of comment by AmeliaBR Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2374#issuecomment-369718620 using your GitHub account
Received on Thursday, 1 March 2018 20:21:29 UTC