您现在的位置:首页 >> 前端 >> 内容

使用@mediascreen实现网页来适应不同的分辨率(代码)

时间:2018/3/16 15:38:29 点击:

  核心提示:写在样式文件中,通过@media screen判断屏幕宽高适应不同分辨率。在不同的宽高下写不同的样式类属性/*适应宽度*/@media screen and (max-width: 1365px) {...

写在样式文件中,通过@media screen判断屏幕宽高适应不同分辨率。在不同的宽高下写不同的样式类属性

/*适应宽度*/
@media screen and (max-width: 1365px) {
  body {
    font-size: 10px;
  }
}
@media screen and (min-width: 1366px) and (max-width: 1599px) {
  body {
    font-size: 12px;
  }
}
@media screen and (min-width: 1600px) and (max-width: 1919px) {
  body {
    font-size: 14px;
  }
}
@media screen and (min-width: 1920px) {
  body {
    font-size: 16px;
  }
}
/*适应高度*/
@media screen and (min-height: 901px) and (max-height: 1080px){
  body {
    font-size: 16px;
  }
}
@media screen and (min-height: 800px) and (max-height: 900px){
  body {
    font-size: 16px;
  }
}

Tags:使用 用M ME ED 
作者:网络 来源:代做javaWeb毕