<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">

<title>响应式</title>

<style>

body{

margin:0;

color:#FFF;

}

.clas {width: 1000px; margin:0 auto; background:#600;}

@media screen and (max-width:980px) {

.clas {width: 500px; margin:0 auto; background:#000;}

 

}

@media screen and (max-width:680px) {

.clas{

width:300px;

background:#F00;

margin:0 auto;

}

}

@media screen and (max-width:320px) {

.clas{

width:200px;

background:#30F;

margin:0 auto;

}

}

</style>

</head>

 

<body>

<div class="clas">

<p>你可以缩小浏览器看看</p>

<p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p><p>你可以缩小浏览器看看</p>

</div>

</body>

</html>

 

 

 

小贾作品