Css框阴影抬起左下角

时间:2012-12-03 22:24:14

标签: css css3

我一直试图弄清楚如何在过去一小时内使用框阴影抬起div的左角。这就是我想要完成的,第3项:http://www.paulund.co.uk/creating-different-css3-box-shadows-effects。我知道有些帖子告诉你如何做到这一点,但我已经尝试了一切,似乎没有任何工作,这让我相信我的代码出了问题。我很感激找到我的错误的任何帮助,谢谢。

HTML

<img class='lazy image effect3' src='http://pearlsquirrel.com/images/lazyload.png' original-src='http://pearlsquirrel.com/profilethumbnails/$thumbnail' width='180' height='180' alt='PearlSquirrel'/>

CSS

.image {
-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;
position:relative;
padding:2px;
background:#fcfcfc;
box-shadow: 0px 0px 1px 1px rgba(0,0,0,0.2);
-o-box-shadow: 0px 0px 1px 1px  rgba(0,0,0,0.2);
-moz-box-shadow: 0px 0px 1px 1px  rgba(0,0,0,0.2);
}
.effect3
{
position: relative;
}
.effect3:before
{
z-index: -1;
position: absolute;
content: "";
bottom: 15px;
left: 10px;
width: 50%;
 top: 80%;
max-width:300px;
background: #777;
-webkit-box-shadow: 0 15px 10px #777;
-moz-box-shadow: 0 15px 10px #777;
 box-shadow: 0 15px 10px #777;
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
-o-transform: rotate(-3deg);
-ms-transform: rotate(-3deg);
transform: rotate(-3deg);
 }

我在此处的示例:http://jsfiddle.net/j4naA/

1 个答案:

答案 0 :(得分:2)

在这里,我尽力在http://www.paulund.co.uk/creating-different-css3-box-shadows-effects复制阴影。

jsFiddle:http://jsfiddle.net/j4naA/19/

HTML:

<div class="effect3" style="margin:20px;">
<img class="effect3" src="http://0777.ir/img/lndl.png"         
original-src="http://pearlsquirrel.com/profilethumbnails/$thumbnail" 
width="180" height="180" alt="PearlSquirrel"/>
</div>​

的CSS:

    .effect3
{
  position: relative;
}
.effect3:before
{
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%;
  top: 80%;
  max-width:155px;
  max-height:18px;
  background: #777;
  -webkit-box-shadow: 0 15px 10px #777;
  -moz-box-shadow: 0 15px 10px #777;
  box-shadow: 0 15px 10px #777;
  -webkit-transform: rotate(-4deg);
  -moz-transform: rotate(-4deg);
  -o-transform: rotate(-4deg);
  -ms-transform: rotate(-4deg);
  transform: rotate(-4deg);
}​