[英]Applying border-radius without applying it to box-shadow
Is there anyway to apply a border radius to a div, but without applying the same "roundness" to the box shadow? 无论如何,是否将边界半径应用于div,但不对框阴影应用相同的“圆度”? I'm using box-shadow without a blur to effectively create two borders for a div, but the light blue box-shadow needs to be squared off.
我正在使用不带模糊效果的框阴影为div有效地创建两个边框,但是浅蓝色的框阴影需要平整。
Thanks! 谢谢!
You can use the outline
CSS property. 您可以使用
outline
CSS属性。 (Outline works in all browsers, except IE7 and below.) (概述适用于除IE7及以下版本的所有浏览器。)
HTML: HTML:
<div class="box"></div>
CSS: CSS:
div {
height: 20px;
width: 20px;
}
.box {
border-radius: 5px;
outline: 1px solid black;
background-color: red;
}
Fiddle: http://jsfiddle.net/xN4pF/ 小提琴: http : //jsfiddle.net/xN4pF/
Or you can nest a <div>
within another. 或者,您可以将
<div>
嵌套在另一个中。
HTML: HTML:
<div class="shadow">
<div class="round"></div>
</div>
CSS: CSS:
div {
height: 20px;
width: 20px;
}
.shadow {
box-shadow: 0 0 0 1px black;
}
.round {
border-radius: 5px;
background-color: red;
}
Fiddle: http://jsfiddle.net/DzCK9/1/ 小提琴: http : //jsfiddle.net/DzCK9/1/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.