What do the crossed style properties in Google Chrome devtools mean?

后端 未结 5 1770
逝去的感伤
逝去的感伤 2020-11-28 18:08

While inspecting an element using Chrome\'s devtools, in the elements tab, the right-hand side \'Styles\' bar shows the corresponding CSS properties. At times, some of these

5条回答
  •  离开以前
    2020-11-28 18:47

    On a side note. If you are using @media queries (such as @media screen (max-width:500px)) pay particular attention to applying @media query AFTER you are done with normal styles. Because @media query will be crossed out (even though it is more specific) if followed by css that manipulates the same elements. Example:

    @media (max-width:750px){
    #buy-box {width: 300px;}
    }
    
    #buy-box{
    width:500px;
    }
    
    ** width will be 500px and 300px will be crossed out in Developer Tools. **
    
    #buy-box{
    width:500px;
    }
    
    @media (max-width:750px){
    #buy-box {width: 300px;}
    }
    
    ** width will be 300px and 500px will be crossed out **
    

提交回复
热议问题