HTML絕對100%的寬度DIV溢出一面
<header>
<div class="container">
<div class="parent">
<div class="child"></div>
</div>
</div>
</header>
CSS
header .parent{
text-align:left;
position: absolute;
z-index: 2;
margin-top: 15%;
}
header .parent .child{
/*Nothing here yet*/
}
我想.parent
是這樣 當我設置.parent
width:100%
,我有這個
的左側是正確的,但其他的溢出
我不想上使用position: relative
.container
因爲.parent
將由其他的div外頭覆蓋,即使我試圖用z-index
有什麼問題嗎?有誰能夠幫助我 ?
謝謝你我這樣的工作,但只有當你知道的'填充。容器「將值放在'left'和'right'上 – user3761386
所以你希望'.parent'的寬度與'.container'的寬度相同嗎? 「.container」的寬度由「.header」的寬度(考慮填充,邊距,邊框)決定。你可以說得更詳細點嗎? –