如何在CSS3中创建阴影边框?

时间:2014-08-02 20:56:06

标签: css3

我想要创建这个边框的秘诀:

Image of the border that I want

1 个答案:

答案 0 :(得分:1)

以下是一个例子:

<div id="box">Content</div>
#box {
  position: relative;
  width: 60%;
  background: #ddd;
  -moz-border-radius: 4px;
  border-radius: 4px;
  padding: 2em 1.5em;
  color: rgba(0,0,0, .8);
  text-shadow: 0 1px 0 #fff;
  line-height: 1.5;
  margin: 60px auto;
}


#box:before, #box:after {
  z-index: -1; 
  position: absolute; 
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%; 
  top: 80%;
  max-width:300px;
  background: rgba(0, 0, 0, 0.7); 
  box-shadow: 0 15px 10px rgba(0, 0, 0, 0.7);
  transform: rotate(-3deg);
}

#box:after {
  transform: rotate(3deg);
  right: 10px;
  left: auto;
}

JSFiddle。代码来自此页面:How to create slick effects with CSS3 box-shadow