css3 - Media Query
常见的属性:
device-width,device-height -- 屏幕宽高
width,height -- 渲染窗口宽高
orientation -- 设备方向
resolution -- 设备分辨率

分辨率改变css的样式
CSS3-Media Query:
device-width, device-height 屏幕宽高
width, height: 渲染窗口宽高
orientation 设备方向
resolution 设备分辨率
css3-Media Query
常见的属性:
device-width,device-height---屏幕宽高
width,height---渲染窗口宽高
orientation---设备方向
resolution----设备分辨率
@media screen and (min-width:480px){
body{background:blue;}
}
当屏幕大于480 背景变成蓝色
<link type="text/css" rel="stylesheet" href="link.css" media="only screen and (max-width:480px)">外链引入
当屏幕小于480的时候才能引用
<link type = "text/css" rel = "stylesheet" href = "link.css" media="only screen and (max-width:480px)"/>
@media screen and (min-with:480px){
body{background:blue;}
}
media query
外部样式引用格式
<link type="text/css" rel="stylesheet" href="link.css" media="only screen and (max-width:500px)"/>
内部引用格式
@media screen and (max-width:500px) {body{background:red}}
css3-Media Query
常见的属性:
device-width,device-height---屏幕宽高
width,height---渲染窗口宽高
orientation---设备方向
resolution----设备分辨率
外链式: media="only screen and (max-width:480px)"//宽度<480px
内嵌式:
@media screen and (mix-width:480px){ }//宽度>480px
css3-Media Query
device-width,device-height 屏幕宽高
width,height 渲染窗口宽高
orientation 设备方面
resolution 设备分辨率
css3-Media Query 常见属性
device-width,device-height——设备宽高/屏幕宽高/物理宽高
width,height——渲染窗口宽高
orientation——设备方向(横屏,竖屏)
resolution——设备分辨率
随着屏幕宽度(分辨率)变化显示也发生变化,样式设计:
该代码写在变化样式中,当屏幕分辨率<=320px时,执行显示该样式
1、外联样式
<link type="text/css" url="css/two.css" media="only screen and (max-width:320px)"/>
2、内嵌样式
<style>@media screen and (ma-width:500px){/*这里面开始写样式*/}</style>
Media Query简单案例
CSS3-Media Query
1.常见属性: device-width,device-height-----屏幕宽高(物理)
width,height -----渲染窗口宽高(浏览器)
orientation -----设备方向(横屏、竖屏)
resolution -----设备分辨率
基本语法:
外联样式
<link type="text/css" rel="stylesheet" href="XXX.css" media="only screen and (max-width:480px)">
当屏幕像素小于480像素时引用css样式
内联样式
<style> @media screen and (min-width:480px){
样式设置
}
响应式写法
外部css
css-media Query
Media Query

123
css3-Media Query
常见的属性:device-width,device-height 屏幕宽高
width,height 渲染窗口宽高
orientation 设备方向
resoulution 设备分辨率
css3-Media Query