我正在與中心包裝(以margin 0 auto爲中心)戰鬥。現在我想從左邊開始一個容器,直到中間包裝器開始。根據這個給定的保證金規格,這是否可能?有沒有一種方法可以覆蓋保證金餘額,儘管有保證金:0與CSS自動?
我真的很感激一些提示!
也看到了小提琴: http://jsfiddle.net/TQhEa/1/
我現在擁有的一切:
我想擁有什麼:
我的代碼:
<body>
<div id="page-wrapper">
<p><---- how can i cover the left side only with red without javascript but keeping the "0 auto margin?"
</div>
</body>
我的CSS:
body, html{
width:100%;
height:100%;
top:0;
margin:0;
background-image: url('http://www.art-wallpaper.net/Full-Size-HD-Wallpaper29/images/HD%20Widescreen%20Wallpaper%2059.jpg');
background-repeat:no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#page-wrapper{
background-color:red;
margin: 0 auto;
width: 400px;
top:0;
margin-top:0;
height:100%;
}
p {
padding:0;
margin:0;
font-size:30px;
}
}
您可以將第二個框放在左側50%寬。 – gaynorvader 2013-03-27 09:59:26