Entire (completely) overwrite CSS styles

后端 未结 3 854
忘掉有多难
忘掉有多难 2021-01-06 08:06

How can I overwrite an entire CSS style for a class, id or other CSS selector?

For example:

If in styles1.css I have:

/* also, t         


        
3条回答
  •  温柔的废话
    2021-01-06 08:49

    Browser will apply css that come last.

    .class {
    font-size: 16px;
    font-size: 14px;
    }
    

    The class will get font-size value 14px.

    You can decleare a css as final.

    .class {
    font-size: 14px !important;
    }
    

    no genarel css rule can alter it.

    Browser uses this method to give priority
    inline < embeded < external < user-agent.

    If you think you need more controll on css then use javascript to directly modfy dom.

提交回复
热议问题