演示代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="reset.css"/>
<style type="text/css">
#zxw{
width: 100px;height: 100px;margin: 100px auto;
background-color: #ff0000;
}
/*
媒体查询:@media
指定某种特定媒体类型:only screen 屏幕等
*/
/* 以下演示屏幕宽度800或800以上时,元素的样式 */
@media only screen and (min-width: 800px) {
#zxw{
background: #00ff00;
}
}
</style>
</head>
<body>
<div id="zxw"></div>
</body>
</html>