我無法讓columnContainer在sectionTwo中居中。代碼如下。無論我做什麼,它似乎都保持一致。保證金:汽車不起作用,其他問題沒有幫助解決它
HTML:
<section class="sectionTwo">
<div class="columnContainer">
<div class="columnExplanation">
<img src="Images/imagehere.png" style="width:150px;height:auto;margin-left:30%;margin-bottom:10px;"/>
<p>text here.</p>
</div>
</div>
</section>
CSS:
section.sectionTwo{
padding-bottom:20px;
width:100%;
height:340px;
position:relative;
background-color:#262626;
border-top: 8px solid #3C3C3C;
}
div.columnContainer{
width:100%;
position:relative;
display:block;
margin-left:auto;
margin-right:auto;
margin-top:20px;
}
感謝您的幫助!
哪個元素必須居中? – 2014-10-11 12:45:31
試試這個 - http://jsfiddle.net/2hh286ys/ – Anonymous 2014-10-11 12:46:31