我有一个居中的容器div,目前有3个其他divs里面。它们都有框阴影(结果添加了大约5px的边距)。100%宽度的div与箱子阴影ovelaps父div
我遇到的问题是第一个div(即将发布)是100%宽度,并且在右侧(overflow: hidden
已设置)被截断。或者它溢出它包含div一点。这样可以,但下面的其他2个div浮动并排,因此不会溢出一点(如果size设置为比可用空间更大,则最近的div会在最后移动)。
填充没有帮助。除了将宽度设置为98%之外,还有其他解决方案吗?
下面是我使用的CSS:
.mainSection{
width:1020px;
margin:70px auto 0px auto;
}
.widget{
background-color:rgba(255, 255, 255, 0.5);
-webkit-box-shadow:0 0 5px 2px #CCC;
-moz-box-shadow:0 0 5px 2px #CCC;
box-shadow:0 0 5px 2px #CCC;
border:1px solid #CCC;
margin:4px;
overflow:hidden;
}
/* 3 child divs */
.widget.upcoming{
float:left;
width:100%;
height:380px;
}
.widget.recent{
float:right;
width:260px;
height:auto;
}
.widget.latest{
float:left;
width:740px;
height:460px;
}
<section class="mainSection">
<article class="widget upcoming">
<header>
<h3>Upcoming</h3>
</header>
</article>
<article class="widget news">
<article>
<p>Some text</p>
</article>
</article>
<article class="widget latest">
<header>
<h3>Latest</h3>
</header>
</article>
<aside class="widget recent">
<header>
<h3>Recent</h3>
</header>
</aside>
</section>
请发表html。 –
是的请html,我试图帮助,如果更多的信息将是真棒http://jsbin.com/uharax/1/ –
添加HTML,请参阅编辑。 – DominicM