媒体查询
@media screen and (max-width:800px){ }
@media screen and (max-width: 600px){
.list{
width: 100%;
height: 100px;
}
}
meta:
<meta name="keywords" content="关键字">
<meta name="description" content="你的网页的内容">
viewport (视窗) :设置视窗布局
<meta name=”viewport” content=”width=device-width,initial-scale=1″ />
width:控制 viewport 的大小,可以指定的一个值,如 600,或者特殊的值,如 device-width 为设备的宽度(单位为缩放为 100% 时的 CSS 的像素);
height:和 width 相对应,指定高度;
initial-scale:初始缩放比例,也即是当页面第一次 load 的时候缩放比例;
maximum-scale:允许用户缩放到的最大比例;
minimum-scale:允许用户缩放到的最小比例;
user-scalable:用户是否可以手动缩放,值为"yes"或"no"。
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
em和rem
em 一个文字的倍数
继承父级元素的字体大小
rem 一个文字的倍数
继承根目录的字体大小
px自动转换成rem网站:
http://mxd.tencent.com/wp-content/uploads/2014/11/rem.html
media-100.css:
<link rel='stylesheet' href='css/media-100.css'>
@media only screen and (min-width: 1080px), only screen and (min-device-width:1080px) {
html,body {
font-size:168.75px;
}
}
@media only screen and (max-width: 1080px), only screen and (max-device-width:1080px) {
html,body {
font-size:168.75px;
}
}
@media only screen and (max-width: 960px), only screen and (max-device-width:960px) {
html,body {
font-size:150px;
}
}
@media only screen and (max-width: 800px), only screen and (max-device-width:800px) {
html,body {
font-size:125px;
}
}
@media only screen and (max-width: 720px), only screen and (max-device-width:720px) {
html,body {
font-size:112.5px;
}
}
@media only screen and (max-width: 640px), only screen and (max-device-width:640px) {
html,body {
font-size:100px;
}
}
@media only screen and (max-width: 600px), only screen and (max-device-width:600px) {
html,body {
font-size:93.75px;
}
}
@media only screen and (max-width: 540px), only screen and (max-device-width:540px) {
html,body {
font-size:84.375px;
}
}
@media only screen and (max-width: 480px), only screen and (max-device-width:480px) {
html,body {
font-size:75px;
}
}
@media only screen and (max-width: 414px), only screen and (max-device-width:414px) {
html,body {
font-size:64.6875px;
}
}
@media only screen and (max-width: 400px), only screen and (max-device-width:400px) {
html,body {
font-size:62.5px;
}
}
@media only screen and (max-width: 375px), only screen and (max-device-width:375px) {
html,body {
font-size:58.59375px;
}
}
@media only screen and (max-width: 360px), only screen and (max-device-width:360px) {
html,body {
font-size:56.25px;
}
}
@media only screen and (max-width: 320px), only screen and (max-device-width:320px) {
html,body {
font-size:50px;
}
}
@media only screen and (max-width: 240px), only screen and (max-device-width:240px) {
html,body {
font-size:37.5px;
}
}