我有一張特定尺寸的圖片:
.image-size {
height: 400px
}
對于較小的螢屏,我減小了這個尺寸:
@media (max-width: 991px) {
.image-size {
height: 280px
}
}
但是列印頁面時,我需要原始尺寸:
@media print {
.image-size {
height: 400px
}
}
我試圖避免代碼冗余
@media print, (max-width: 50000px)
.image-size {
height: 400px
}
@media (max-width: 991px) {
.image-size {
height: 280px
}
}
但這不適用于小螢屏,因為列印尺寸 400 被小螢屏尺寸 280 覆寫。
有沒有辦法避免代碼冗余?
非常感謝!
uj5u.com熱心網友回復:
您可以screen為回應規則指定媒體:
.image-size {
height: 400px
}
@media screen and (max-width: 991px) {
.image-size {
height: 280px
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/377803.html
標籤:css
下一篇:中心ngx-分頁
