1. 不使用viewport出现的问题
提到响应式设计,大家首先想到的可能是 Bootstrap , @media 。前者是一个响应式UI库,风格比较扁平化,类似的还有雅虎的Pure。@media是CSS3的属性,利用它可以在不依赖其他库的情况下实现响应式设计。如果你使用过媒体查询,应该熟悉下面的代码:
可查看github下载实例代码
@media screen and (min-width: 960px) {
body { background-color: blue; }
}
@media screen and (max-width: 960px) and (min-width: 500px) {
body { background-color: red; }
}
@media screen and (max-width: 500px) {
body { background-color: yellow; }
}
我在body里加了一段话,在PC端效果如下:
开始: