我試圖實現兩個列布局頁面的身體寬度100%和一列寬度爲30%和其他70%。但第二列[width:70%]不起作用。css的百分比寬度不工作
HTML:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="offer-details">aaaaaaaaaaaaaaaaaaaaaaaaa</div>
<div class="offer-map">bbbbbbbbbbbbbbbbbbbbbbbbbbbb</div>
</body>
</html>
CSS
html {
height: 100%;
}
body {
background-color: #F3F3F3;
width: 100%;
height: 100%;
font-family: 'Helvetica Neue', helvetica, Arial, sans-serif;
overflow: hidden;
}
* {
margin: 0;
padding: 0;
}
.offer-details {
float: left;
width: 30%;
height: 100%;
background-color: inherit;
text-align: justify;
overflow: auto;
}
.offer-map {
float: left;
width: 70%;
height: 100%;
background-position: center center;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
-webkit-transition: opacity 1s cubic-bezier(0.770, 0.000, 0.175, 1.000);
border-left: 5px solid #E1E1E1;
overflow: auto;
background-color: white;
}
jQuery的
$(function() {
var width = $(document).width()+"px";
var height = $(document).height()+"px";
$('body').css({'width': width, 'height': height});
})
這裏是jsfiddle。當我嘗試第二列的69%時顯示,但它沒有覆蓋屏幕。我怎樣才能使30%和70%的列都覆蓋屏幕?
全屏的jsfiddle:http://jsfiddle.net/yBNEr/2/embedded/result/
謝謝!