user3207200
user3207200

Reputation: 33

box-shadow on css triangle not working

it seem impossible to apply shadow on my css triangle? other example work because their markup is different.

div:before{  
    content: "";
   width: 0;
   height: 0;
   position: relative;
   top: 15px;
   border-style: solid;
   border-width: 12px 12px 0 12px;
   border-color: #000 transparent transparent transparent;
   -webkit-transform: rotate(270deg); 
    -webkit-transform-origin: 50% 50%;
    -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    box-shadow: 0 1px 2px #000;
}

http://jsfiddle.net/2dmJp/2/

Upvotes: 2

Views: 2756

Answers (2)

Naele
Naele

Reputation: 530

You can use filter:

    div {
      width: 0; 
      height: 0; 
      border-left: 20px solid transparent;
      border-right: 20px solid transparent;
      border-top: 20px solid #f00;
      -webkit-filter: drop-shadow(0 1px 2px #000);
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
    }

http://jsfiddle.net/Rn37T/1/

It isn't supported in IE9 and earlier.

Upvotes: 8

Becario Senior
Becario Senior

Reputation: 714

cross-browser solution using transform rotate: codepen.io/ryanmcnz/pen/JDLhu

Upvotes: 2

Related Questions