CSS Box-Shadow为Div添加了任意白色边框 [英] CSS Box-Shadow adds arbitrary white border to Div
本文介绍了CSS Box-Shadow为Div添加了任意白色边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我向包含img的元素添加了一个框阴影,它在元素的底部创建了一个任意的白色边框。没有通过CSS应用边框(我甚至尝试覆盖与 border:none;
没有运气)。当直接应用于图像时,它会正确显示。但是当应用到包含图片的div时,会出现边框。
I'm adding a box shadow to an element containing an img and it's creating an arbitrary white border on the bottom of the element. No border is being applied via CSS (and I even tried overriding with border:none;
without luck). When applied to the image directly, it appears properly. But when applied to a div containing an image, the border appears.
任何帮助都是灰色的。
<style>
html,body,div,img {margin:0; padding:0;}
body {padding:50px;}
.badge_image {
float:left;
/* css drop shadow */
-webkit-box-shadow: 1px 1px 5px 0px #a2958a;
-moz-box-shadow: 1px 1px 5px 0px #a2958a;
box-shadow: 1px 1px 5px 0px #a2958a;
}
</style>
<div class="badge_image">
<img src="badge-image.jpg" height="75" width="75" />
</div>
<br clear="all" /><br clear="all" />
<img src="badge-image.jpg" height="75" width="75" class="badge_image" /><!-- works fine -->
推荐答案
尝试显示图像块。
.badge_image img {
display: block;
}
这篇关于CSS Box-Shadow为Div添加了任意白色边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文