Override element.style using CSS
I have an HTML page from page builder, and it injects style
attribute directly to the element. I found it's considered as element.style
.
I want to override it using CSS. I can match the element, but it doesn't override it.
How can I override the style using CSS?
Although it's often frowned upon, you can technically use:
display: inline !important;
It generally isn't good practice but in some cases might be necessary. What you should do is edit your code so that you aren't applying a style to the <li>
elements in the first place.
This CSS will overwrite even the JavaScript:
#demofour li[style] {
display: inline !important;
}
or for only first one
#demofour li[style]:first-child {
display: inline !important;
}
element.style
comes from the markup.
<li style="display: none;">
Just remove the style
attribute from the HTML.