How to use important keyword

 


In this post, you will learn about what is the significance of the important keyword in CSS and how to use it.


! important keyword will override all previous styling rules for that specific property on that element!


FOR EXAMPLE:


Before applying important:


<div class="a"></div>

<style>.a{

  height: 30px;

  width: 400px;

  width: 700px;

  background-color: black;

 }</style>


OUTPUT:

Here  width=700px;


After applying important:

<div class="a"></div>

<style>.a{

  height: 30px;

  width: 400px !important;

  width: 700px;

  background-color: black;

 }</style>


OUTPUT:

Here  width=400px;

0 comments: