2017-08-24 122 views
0

我知道如何在CSS中請求max-widthmax-height。我通常不喜歡這樣寫道:CSS我如何要求最大高度和最大寬度?

@media screen and (max-width: 1920) {}

height

@media screen and (max-height: 1080) {}

但如何將我寫的,如果我想問問,如果它是在兩個max-heightmax-width相同的規則

+0

[MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries)'@media screen and(max-width:1920)and(max-height:1080 ){}' – Axel

回答

0

您可以使用「和」來組合括號條件語句。

@media screen and (max-width: 1920px) and (max-height: 1000px) { ... }

0

您可以使用&&選擇

(max-width: 1920) && (max-height: 1000px) {} 
0

如果我理解你correclty,你想要做的是要求在同一個查詢字符串的句子都最大高度和最大寬度。如果是這種情況,你只需要創建這個CSS塊:

@media screen and (min-height: 720px) and (min-width: 1920px) { 
    /* CSS rules here*/ 
} 

讓我知道如果這是你所需要的。

如果你想問一個或其他只是用and換一個逗號。

相關問題