remove / reset inherited css from an element

前端 未结 9 1308
攒了一身酷
攒了一身酷 2020-12-06 04:00

I know this question was asked before, but before marking it as a duplicate, I want to tell you that my situation is a little different from what I found on the internet.

9条回答
  •  温柔的废话
    2020-12-06 04:32

    Only set the relevant / important CSS properties.

    Example (only change the attributes which may cause your div to look completely different):

    background: #FFF;
    border: none;
    color: #000;
    display: block;
    font: initial;
    height: auto;
    letter-spacing: normal;
    line-height: normal;
    margin: 0;
    padding: 0;
    text-transform: none;
    visibility: visible;
    width: auto;
    word-spacing: normal;
    z-index: auto;
    

    Choose a very specific selector, such as div#donttouchme,

    . Additionally, you can add `!important before every semicolon in the declaration. Your customers are deliberately trying to mess up your lay-out when this option fails.

提交回复
热议问题