-1

我需要像上图那样做一个阴影效果。我更喜欢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;
}

在此处输入图像描述

4

2 回答 2

2

http://jsfiddle.net/SG9pd/

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;
}

使用:http: //www.colorzilla.com/gradient-editor/

于 2013-03-01T00:31:08.653 回答
1

此处仅使用 css 是您的解决方案的链接

用于演示

visit http://jsfiddle.net/a92My/ 
于 2013-03-01T06:13:15.213 回答