我需要像上面的图像一样做阴影效果。我更喜欢CSS,所以我尝试这个代码,但(平滑)边框不相同。有什么最好的方法吗?
<div class="box"></div>
.box {
height: 1px;
width: 13em;
-moz-border-radius: 5px;
border-radius: 5px;
background-color:#191919;
-moz-box-shadow: 0 0 3px 3px #191919;
-webkit-box-shadow: 0 0 3px 3px #191919;
box-shadow: 0 0 3px 3px #191919;
}
答案 0 :(得分:2)
div {
background: -moz-radial-gradient(center, ellipse cover, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 60%, rgba(0,0,0,0) 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(0,0,0,0.65)), color-stop(60%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 60%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 60%,rgba(0,0,0,0) 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 60%,rgba(0,0,0,0) 100%); /* IE10+ */
background: radial-gradient(ellipse at center, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 60%,rgba(0,0,0,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
width: 300px;
height: 20px;
}
答案 1 :(得分:1)
这里只使用css是解决方案的链接
for demo
visit http://jsfiddle.net/a92My/