What is the order of precedence for CSS?

前端 未结 8 1743
攒了一身酷
攒了一身酷 2020-11-22 09:43

I\'m trying to figure out why one of my css classes seems to override the other (and not the other way around)

Here I have two css classes

.smallbo         


        
8条回答
  •  悲&欢浪女
    2020-11-22 10:15

    Also important to note is that when you have two styles on an HTML element with equal precedence, the browser will give precedence to the styles that were written to the DOM last ... so if in the DOM:

    
    
    
    
    
    
    
    Hello World

    ...the width of the div will be 50px

提交回复
热议问题