首页 > 代码库 > css media
css media
<link rel="stylesheet" href="http://www.mamicode.com/middle.css" media="screen and (min-width: 400px)"> 屏幕尺寸大于400px时使用该css
<link rel="stylesheet" href="http://www.mamicode.com/middle.css" media="screen and (max-width: 399px)"> 屏幕尺寸小于399px时使用该css
body{
background
:
blue
;}
/*宽度500px-800px之间+高度100px-400px之间 蓝色*/
@media
screen
and (
max-width
:
500px
){body{
background
:
green
;}}
/*宽度小于500px时 绿色*/
@media
screen
and (
min-width
:
800px
){body{
background
:
red
;}}
/*宽度大于800px时 红色*/
@media
screen
and (
max-height
:
100px
){body{
background
:yellow;}}
/*高度小于100px时 黄色*/
@media
screen
and (
min-height
:
400px
){body{
background
:pink;}}
/*高度大于400px时 粉色*/
css media
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。