【问题标题】:Drop shadow - no rounded corners or blurring to shadow阴影 - 没有圆角或模糊阴影
【发布时间】:2013-05-31 14:57:20
【问题描述】:

我从这里了解到 css box shadow 属性: http://css-tricks.com/snippets/css/css-box-shadow/

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

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

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

【问题讨论】:

  • 你能告诉我们你已经尝试过什么吗?你到底想要什么?
  • 好吧,我认为这将是一个简单的帖子。这是一个比较链接:new.tsaviation.com/images/cpm155/…
  • 谢谢,我想我明白了你的要求,看我的回答。

标签: css roundedcorners-dropshadow


【解决方案1】:

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

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

DEMO

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 */

}

【讨论】:

    猜你喜欢
    • 2020-05-06
    • 1970-01-01
    • 2017-11-17
    • 2014-09-15
    • 2016-10-05
    • 2016-02-20
    • 2011-09-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多