0

我从这里阅读了有关 css 框阴影属性的信息:http: //css-tricks.com/snippets/css/css-box-shadow/

我想使用类似的阴影:.one-edge-shadow.
问题是我不希望阴影的角落模糊(和圆角)。

我怎样才能做到这一点?(最好优雅地)。

编辑:
比较图像: http: //new.tsaviation.com/images/cpm155/drop-shadow-vs-bottom-shading.jpg

4

1 回答 1

0

据我了解,您想要一个底部阴影,它的底角没有半径属性,对吧?

如果是这样,您可以“附加”一个“阴影”,它基本上是一个具有渐变背景的 div。

演示

HTML:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <!-- Trick shadow -->
  <div id="box">
    <div class="shadow-bottom"></div>
  </div>
</body>
</html>

CSS:

#box{
  width:5em;
  height:5em;
  background-color:#6c6c6c;
  margin:5em auto;
}

/* New shadow element */
.shadow-bottom{
  position:relative;
  top:5em;/*height of box*/
  height:25%;
  width:100%;
background: -moz-linear-gradient(top,  rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* IE10+ */
background: linear-gradient(to bottom,  rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); /* IE6-9 */

}
于 2013-06-02T15:06:48.143 回答