Skip to content

1、CSS3 calc() 属性 尺寸计算

div {
    width: -webkit-calc(100% - 50px);
    width: -moz-calc(100% - 50px);
    width: calc(100% - 50px);
    background-color: #FF0000;
    height: 500px;
}

2、判断屏幕宽度

@media screen and (min-width: 1201px) {
    .abc {width: 1200px}
}
@media screen and (max-width: 1200px) {
    .abc {width: 900px}
}

3、横屏和竖屏

@media only screen and (orientation: landscape) {
        仅仅竖屏下
}
@media only screen and (orientation: portrait) {
        仅横屏
}