我正在开发一个简单的css主题,我使用左中右布局,我使用float
来定位右和左元素,margin
为中心。 但是,如果我看看网站,所有的网站部分都进入对方。
这是我已经得到了现在:元素进入彼此
HTML
<div class="container">
<div class="right">
<div class="block">
<div class="title">My Block Of Data Here Is Title</div>
This is my block of data! Here i can show website stats and announcements.
</div>
</div>
<div class="left">
<div class="block">
<div class="title">My Block Of Data Here Is Title</div>
This is my block of data! Here i can show website stats and announcements.
</div>
</div>
<div class="center">
<div class="block">
<div class="title">Welcome to SITE_TITLE_HERE!</div>
This is where we post so many stuff!<br><br><br><br><br><br><br><br><br><br>Thanks, SITE_TITLE_HERE stuff.
</div>
</div>
</div>
CSS
body{
font-family: 'Open Sans Condensed', sans-serif;
font-size: 18px;
}
.container{
margin: 0 auto;
width: 65%;
}
.left{
float: left;
width: 20%;
}
.right{
float: right;
width: 20%;
}
.center{
margin: 0 auto;
width: 60%;
}
.block{
width: 100%;
padding: 3px;
background: #fafafa;
outline: 1px solid #f2f2f2;
outline-offset: 2px;
text-align: center;
}
.block .title{
font-size: 24px;
border-bottom: 1px solid #000;
background: #76E0EE;
}
小提琴: http://jsfiddle.net/XK6dN/2/
更新:我几乎可以肯定它是块类的outline
,但即使它那是。我怎样才能让他们免于凌驾对方?
把你的代码在这里,在这个问题,但保留链接小提琴。 –
@RobertHarvey +,jsFiddle链接仍然非常有用。 – brandonscript
@RobertHarvey谢谢,刚刚更新了帖子。 –