首页 > Web开发 > 详细

使用@media screen实现网页适应不同的分辨率

时间:2017-11-01 12:47:41      阅读:271      评论:0      收藏:0      [点我收藏+]

响应式web设计之@media

有多种使用方式:

1、在link中判断屏幕宽高,然后引用不同的css文件:
<link rel="stylesheet" type="text/css" href="style.css" media="screen and (min-width: 800px)">

2、写在样式文件中,通过判断屏幕宽高适应不同分辨率

//适应宽度
@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;
  }
}

 

使用@media screen实现网页适应不同的分辨率

原文:http://www.cnblogs.com/zhouzhou826/p/7765720.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!