Style Override Technique

p { 
   font-size: 24px !important; 
}

The !important rule at the end of a value will override any other style declarations of that attribute, including inline styles.

Comments

  1. User Avatar
    mansur
    Permalink to comment#

    Wow… I learn new thing here… TQ for the snippet..

    • User Avatar
      hanif kasai
      Permalink to comment#

      Yo man really cool. I agree with mansur. Learnt a new evil technique.

    • User Avatar
      sondra
      Permalink to comment#

      I am trying to clean up a mess that was created from Framemaker and trying to override a bunch
      of styles using a style sheet.

      I tried using the following code but it seems to ignore it

      ul.B-Bullet1 {
      list-style-type: circle !important;
      font-family: “Arial”, Verdana, sans-serif;
      color: #17202A;
      margin-left: 30px !important;
      font-size: 100%;
      }

      ul.B-Bullet2{
      list-style-type: square !important;
      font-family: “Arial”, Verdana, sans-serif;
      color: #17202A;
      margin-left: 30px !important;
      font-size: 100%;
      }

      what am i doing wrong?

  2. User Avatar
    Chris

    It’s evil!!!
    Code clean and you dont have to do this.

  3. User Avatar
    Joachim
    Permalink to comment#

    Chris, it’s not evil but sometimes neccessary. Imagine you use something like Joomla and need to chnage CSS styles of a module. If they update the module all is gone. But if you extract the styles you want to edit and “import” them, you can attach your onw CSS with the changes and most times you will have no trouble updating :)

  4. User Avatar
    Abhinav Banerjee(India)
    Permalink to comment#

    how to overrid the color of sticky color style:
    For Example:
    .sticky{
    color:#000;
    }
    .nav{
    color:#fff;
    }
    I get #fff as color even when sticky class is added in sticky navigation.
    Please Help!!

    • User Avatar
      brute11k
      Permalink to comment#

      You should write next CSS statement if this navigation element contains both classes.

      .sticky.nav {
        color: #000;
      }
      

      If you need to override the navigation element inside sticky element:

      .sticky .nav {
        color: #000;
      }
      
  5. User Avatar
    chris
    Permalink to comment#

    good good I learnt something new today

  6. User Avatar
    Vinay
    Permalink to comment#

    Great Boss.. thank you!!

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-closeicon-emailicon-linkicon-logo-staricon-menuicon-searchicon-staricon-tag