Overriding properties in CSS

后端 未结 6 1749
忘了有多久
忘了有多久 2021-02-07 14:06
#iddiv span {
    display: inline-block;
    width: 190px;
}
.myclass {
    width:10px;
}

Then I have

<
6条回答
  •  一整个雨季
    2021-02-07 14:27

    Because id+selector (#iddiv span) is more specific than a class. Either

    #iddiv span.myclass
    

    or

    #iddiv .myclass
    

    should work for this case.

    Learn more about CSS specificity here or by Googling it.

提交回复
热议问题