Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS box shadow around triangle

Tags:

html

css

shadow

I need to create a triangle with a drop shadow using simple html and css. Answered by another stackoverflow question, I was able to create the triangle with mitered borders. Basically I create 1 side of a box with a very wide border and the nearby side with a wide transparent border:

div.triangle {
    border-bottom : 60px solid transparent;
    border-left : 60px solid black;
}

works great, but when I try to apply a box-shadow the shadow goes around the enclosing square... not the triangle:

div.triangle {
    border-bottom : 60px solid transparent;
    border-left : 60px solid black;
    -webkit-box-shadow: 0 0 10px black;
}

How do I get a triangle using only css/html with a drop shadow?

like image 303
at. Avatar asked Mar 16 '11 21:03

at.


1 Answers

Seems like impossible. Definitely using an imagine is much more easier solution. I've made something like triangle :) http://jsfiddle.net/5dw8M/109/ . Sorry cannot leave a comment under your post. May be it'll serve like an inspiration for someone;

like image 156
ted Avatar answered Oct 02 '22 03:10

ted