css响应式布局RWD

响应式布局结合了三大理念:

1)用于布局的弹性网络(百分比定义宽度)

2)用于图片和视频的弹性媒体

3)媒体查询

在布局中,需要注意的点有:

1)尽量用min-width/max-width,max-height/min-height代替width,height

2)尽量使用百分比,em为单位代替精确值

3)采用媒体查询

 

二、媒体查询

IE8以下不支持媒体查询,需要引入

<!-- if lte IE 8>
<script src="response.min.js"></script>
<![endif]-->

媒体查询需要设置断点,常见的断点如480px,769px等。也可以逐渐缩小浏览器的宽度,观察布局效果来引入。

媒体查询引入的方式有两种

1)通过link标签引入

<link rel="stylesheet" href="css/small.css" media="(max-width:480x)">
<link rel="stylesheet" href="css/large.css" media="(min-width:769x)">
<link rel="stylesheet" href="css/large.css" media="(min-width:480px) and max-width(768px)">

2)将查询包含在样式表中

@media(max-width:480px){
}
@media(min-width:480px) and (max-width:768px){
}
@media(min-width:769px){
}

 

转载于:https://www.cnblogs.com/bobodeboke/p/6235001.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值