【发布时间】:2015-10-18 04:14:03
【问题描述】:
向网站添加响应式媒体查询的最佳方法是什么? ...以什么顺序和方法? 有人说移动优先是一种方法,但我想知道以下内容是否更容易管理以平均屏幕尺寸为目标(填充所有页面元素,稍后一些将隐藏在小屏幕上,例如面包屑链接) 以便为页面定义“所有”css 样式、布局、排版等,以便每个元素都获得其默认样式。 然后其他查询将仅定义影响每个较小尺寸选项的更改。因此“all”块将是最大的,然后所有其他媒体查询将只是应用调整以覆盖默认样式。
@media all { /* including all styles for all elements */ }
@media (min-width: 1200px) { /* only add styles that differ from "all" and target this size changes */ }
@media (min-width: 992px) and (max-width: 1199px) { /* only add styles that differ from "all" and target this size changes */ }
@media (min-width: 768px) and (max-width: 991px) { /* only add styles that differ from "all" and target this size changes */ }
@media (max-width: 767px) { /* only add styles that differ from "all" and target this size changes */ }
@media (max-width: 480px) { /* only add styles that differ from "all" and target this size changes */ }
【问题讨论】:
标签: css mobile responsive-design media-queries