Medium Feed


Wednesday, February 4, 2015

Override Inline CSS Styles - HTML / CSS trick

Sometimes there is a need to override inline style with css. Good example might be the code where you don’t have an option to remove a markup , where finding a place where inline code is coming from might be a challenge.

Here is how you can override it. There are two elements involved in doing that:

  [style]   addition to existing css code
  !important  line in css code

<div class="FirstDiv" style="background: red;"> The inline styles for this div should make it red. </div>

You can overwrite/change the above in-line css by the below method


background: green !important;


  1. Extremely useful information which you have shared here about CSS selectors. This is a great way to enhance knowledge for us, and also beneficial for us. Thank you for sharing a post like this. Web Design & Development Company in Pune

  2. Your article is really awesome I would like to visit your blog again. Nice Stuff, it was nice to see this article. Top Web Development Company in Melbourne