您的位置:首页 > Web前端 > CSS

css媒体查询之device-width

2015-12-30 22:40 585 查看

几个典型的应用例子

@media screen and (device-width:1024px){ … }
@import url(example.css) screen and (min-device-width:800px);
<link media="screen and (min-device-width:300px) and (max-device-width:900px)" rel="stylesheet" href="example.css" />


应用例子演示

<!doctype html>
<html>
<head>
<title>Test media query of device</title>
<style>
@media screen and (device-width:600px){
body{background-color:green;}
}
</style>
</head>
<body>
<h1>Test device query</h1>
</body>
</html>


当设备的屏幕宽度为600px的时候,页面的背景颜色为绿色的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: