2015-12-11 42 views
0

我看到有人在代碼中使用它,並想知道這將如何工作。我已經看到了最小寬度和最大寬度,但從來沒有這樣。這是否意味着只有在寬度小於460像素的情況下運行,使768像素最大寬度參數不相關?媒體查詢中的兩個最大寬度

@media (max-width: 768px) and (max-width: 460px) { 
CSS goes here 
} 
+0

你確定這不是一個錯字? – Chad

+0

這不是一件特別的事情,它會佔用最小的最大寬度 –

回答

1

這不是一件特別的事情,它會佔用最小的最大寬度

https://jsfiddle.net/

.dog { 
 
    background: green; 
 
    height: 200px; 
 
    width: 200px 
 
} 
 

 
.width { 
 
    height: 30px; 
 
    background: blue; 
 
    width: 460px; 
 
} 
 
@media (max-width: 460px) and (max-width: 768px) { 
 

 
    .dog { 
 
    background: red; 
 
    } 
 

 
}
<div class="width" width="460px"> 
 

 
</div> 
 
<div class="dog"> 
 

 
</div>

相關問題