我正在处理响应式网格,并且我试图在每个分辨率的主要div 的所有四个边上保持边距相同。我已经在主要div上设置了0自动保证金,这使得它在右侧和左侧保持相同但是顶部和底部是什么?
<div id = "wrapper">
<header id = "header"> <p> this is the header</p></header>
<div id = "main">
<div id = "" class = "col col3">
<div class = "img-col"><img src = "images/image.png"></div>
<div class = "text-col">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel eros libero. Fusce id semper orci. Morbi imperdiet sit amet elit vel consectetur. Nam suscipit sem blandit est consectetur iaculis. Vestibulum sed dolor elementum, viverra sapien id, sollicitudin nibh. Integer quis venenatis ligula.Nam suscipit sem blandit est consectetur iaculis.</p>
</div>
</div>
<div id = "" class = "col col1">
<div class = "img-col"><img src = "images/image.png"></div>
<div class = "text-col">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel eros libero. Fusce id semper orci. Morbi imperdiet sit amet elit vel consectetur. Nam suscipit sem blandit est consectetur iaculis.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vel eros libero.Lorem ipsum dolor sit amet,. </p>
</div>
</div>
</div>
#main {
width:90%;
margin:0 auto;
}
.col {
float:left;
margin: 1% 0px 1% 1.6%;
background-color:#FF0000;
}
答案 0 :(得分:2)