添加断点
@media only screen and (max-width:500px){
body{
background-color: #ff1212;
}
}
[class="xxx"]*
不是所有类的意思,是class中含有指定的xxx字符;
WEB端优先,移动端统一处理
<big>dreamdreamdream.cn在手机上显示方式与web不同的原因:
/* For desktop: /
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
.col-4 {width: 33.33%;}
.col-5 {width: 41.66%;}
.col-6 {width: 50%;}
.col-7 {width: 58.33%;}
.col-8 {width: 66.66%;}
.col-9 {width: 75%;}
.col-10 {width: 83.33%;}
.col-11 {width: 91.66%;}
.col-12 {width: 100%;}
@media only screen and (max-width: 768px) {
/ For mobile phones: /
[class="col-"] {
width: 100%;
}
}
移动端优先
[class="col-"] {
width: 100%;
}
@media only screen and (min-width: 768px) {
/ For desktop: */
.col-1 {width: 8.33%;}
.col-2 {width: 16.66%;}
.col-3 {width: 25%;}
.col-4 {width: 33.33%;}
.col-5 {width: 41.66%;}
.col-6 {width: 50%;}
.col-7 {width: 58.33%;}
.col-8 {width: 66.66%;}
.col-9 {width: 75%;}
.col-10 {width: 83.33%;}
.col-11 {width: 91.66%;}
.col-12 {width: 100%;
}
}
横屏/竖屏
orientation:portrait | landscape
portrait:指定输出设备中的页面可见区域高度大于或等于宽度
landscape: 除portrait值情况外,都是landscape
@media only screen and (orientation: landscape) { body {
background-color: lightblue;
}
}