Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asymmetric CSS Shadow

Tags:

css

How Can I create a shadow like this one? Only at the bottom corners and gradient.

enter image description here

like image 374
Ammar Avatar asked Aug 25 '16 06:08

Ammar


1 Answers

Use your CSS like follows.

HTML

<div class="box mybox">
    <h3>My Box</h3>
</div>

CSS

.box h3{
	text-align:center;
	position:relative;
	top:80px;
}
.box {
	width:70%;
	height:200px;
	background:#FFF;
	margin:40px auto;
}

/*==================================================
 * MyBox
 * ===============================================*/
.MyBox
{
  position: relative;
}
.MyBox:before, .MyBox:after
{
  z-index: -1;
  position: absolute;
  content: "";
  bottom: 15px;
  left: 10px;
  width: 50%;
  top: 80%;
  max-width:300px;
  background: #777;
  box-shadow: 0 15px 10px #777;
  transform: rotate(-3deg);
}
.MyBox:after
{
  transform: rotate(3deg);
  right: 10px;
  left: auto;
}
<div class="box MyBox">
	<h3>MyBox</h3>
</div>
like image 76
Usman Avatar answered Oct 29 '22 06:10

Usman