我想調整div的寬度,當瀏覽器使用最大寬度減小大小。該div做一切,但改變寬度。我通過chrome瀏覽器上的開發人員工具查看了它,並且寬度被削減了。怎麼了?媒體查詢div不改變寬度,但其他一切工作
HTML
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" type="text/css" media="screen and (max-width: 500px)" href="responsive.css" />
</head>
<body>
<div class="left">
</div>
<div class="containerRight">
<div class="incontainer">
<div class="post"> Aifjoisdjfiosjdfoisdjfoidsjfoisjd</div>
</div>
</div>
</body>
</html>
主css:
*{
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
html, body {
height:100%;
}
body {
padding:60px 0 0 0; /* 60 — header height*/
margin:0;
}
.main {
min-width:100%;
height:60px;
margin-top: -60px; /* 60 — header height*/
margin-left: -300px;
border-bottom: solid 1pt #ADADAD;
}
.containerRight {
float:left;
width:100%;
height: 100%;
overflow-y: scroll;
}
.left {
float:left;
height: 100%;
width: 300px;
border-right: solid 1px #C9C9C9;
-webkit-box-shadow: 1px 0 2px #888888;
-moz-box-shadow: 1px 0 2px #888888;
box-shadow: 1px 0 2px #888888;
}
RESPONSIVE CSS
.left {
width: 800px;
background-color: red;
}
.containerRight {
display: none;
}
什麼是您的媒體查詢? – Newtt 2014-10-01 13:33:58
media = screen我只是通過改變瀏覽器的大小來測試它。如果我沒有回答你的問題,我很抱歉。我不確切地知道你的意思。 – user3173447 2014-10-01 13:38:38
@ user3173447你的問題說媒體查詢div沒有改變寬度,但在你的描述中,根本沒有媒體查詢 – Huangism 2014-10-01 13:44:47