How does a CSS rule override another CSS rule?

后端 未结 4 575
无人共我
无人共我 2020-12-05 16:20

So, this is what I\'m doing:

#id-form td {
padding: 0 0 10px 0;
}

#particular-td {
border: 1px solid black;
text-align: center;
background-color: #DFDFDF;
h         


        
4条回答
  •  一个人的身影
    2020-12-05 16:44

    You have two ways, either add !important after your padding for the particular-td:

    padding: 10px !important;
    

    OR, your selector altered like so:

    table#id-form td#particular-td {
    border: 1px solid black;
    text-align: center;
    background-color: #DFDFDF;
    height: 30px;
    padding: 10px;
    }
    

    Both are fine. Personally I don't like the use of !important if I can avoid it.

提交回复
热议问题