Social Icons

Wednesday, February 18, 2015

How to override inline css

Generally, inline css is meant to be used to override external css. But sometimes, it needs that you cannot remove the inline css for an element and you have to overrride that using some external css. You can do this using "!important" in css

Say for example, you have a "p" element as follows:

<p id="mypara" style="color:red">
    Paragraph content
</p>

Here, you have to change the "p" background to blue color with external css i.e, you have to override the inline one. You can do this as follows:

#para {
    color: blue; !important
}

No comments:

Post a Comment

Total Pageviews