Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Separated oval shadow below a box with css3

Separated oval shadow below a box with css3

Problem

How would you achieve an 10px high Oval Blurry Shadow below a 200px box?

.box {
  width:200px;
  height:200px;
  background: #c00;
  position:relative;
}
.box:before {
  content:'';
  position: absolute;
  bottom: -20px;
  left:20px;
  width: 210px;
  height: 10px;
  background: none; /*This cuts off some portion of the box shadow*/
  -moz-border-radius: 100px / 50px;
  -webkit-border-radius: 100px / 50px;
  border-radius: 100px / 50px;
  -webkit-box-shadow: 0 15px 10px #000000;   
  -moz-box-shadow: 0 15px 10px #000000); 
  -0-box-shadow: 0 15px 10px #000000);   
  box-shadow: 0 15px 10px #000000;  
}   

http://jsbin.com/uqugob The above code almost perfect, except that I want a more thin oval blurry Shadow, and remove the disturbing white background of :before.

Thanks, finally I got it as expected, almost, except that the left and right should be more blurry: http://jsbin.com/uqugob/4

Thanks

Problem courtesy of: swan

Solution

removed the styles with vendor-prefixes (they were annoying, you can add them back using what i provided) but here's the shadow's code:

.box:before {
  content:'';
  position: absolute;
  bottom: -50px;
  left:20px;
  width: 210px;
  height: 30px;
  background: #333;
  border-radius: 200px / 30px;   
  box-shadow: 0 0 10px 10px #333;   
}
Solution courtesy of: Joseph

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Separated oval shadow below a box with css3

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×