我是 CSS 初學者,我不知道我是否正確理解媒體查詢。要有這樣的 css 結構:general css fonts, paddings, colors, etc css for small screens (up to 499px) specific css for this resolution css for large screen (more than 500px) specific css for this resolution css specific for impression specific css for this case, for example different text color, etc 正確的媒體查詢結構是這樣的嗎?/* GENERIC CSS */ /* CSS for small screens */ @media only screen and (max-width: 499px) { ... }/* CSS for small screens */@media only screen and (min-width: 500px) { ... }/* CSS for some specific changes like text color, etc for printing on paper */@media print {...}
1 回答

至尊寶的傳說
TA貢獻1789條經驗 獲得超10個贊
因此,一般來說,CSS 文件應該在媒體查詢之上使用通用 CSS 來構建。
然后,如果您想在較小的屏幕尺寸下更改 CSS,您可以使用max-width
媒體查詢。可以這樣想,@media (max-width: 568px)
這意味著該 css 將應用的最大屏幕尺寸是 568 像素。任何大于此值的值,CSS 將不再適用。
同樣適用于min-width
. @media (min-width: 569px)
表示此 CSS 將應用的最小寬度是 569 像素。任何低于 569(例如 568px)像素的值將不再適用。屏幕必須至少為 569 像素才能拾取它。
打印是直接的,這就是打印頁面時將顯示的內容。
希望有幫助!從您發布的內容來看,該結構 100% 正確。
- 1 回答
- 0 關注
- 104 瀏覽
添加回答
舉報
0/150
提交
取消