Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can this shadow be created in CSS?

Tags:

css

How can the following dual angled shadow be created in CSS? Is it even possible?

enter image description here

like image 254
Hopstream Avatar asked Dec 16 '22 23:12

Hopstream


1 Answers

Use the following HTML:

<div class="box"></div>​

and the following CSS:

.box {
    width:70%;
    height:200px;
    margin:40px auto;
    position: relative;
    background-color: red;
}
.box:before, .box:after {
  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);
}
.box:after {
  -webkit-transform: rotate(3deg);
  -moz-transform: rotate(3deg);
  -o-transform: rotate(3deg);
  -ms-transform: rotate(3deg);
  transform: rotate(3deg);
  right: 10px;
  left: auto;
}​

See this live example

like image 119
jacktheripper Avatar answered Jun 06 '23 14:06

jacktheripper