我无法让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