CSS box shadow around triangle

http://stackoverflow.com/questions/5332366

by Marcel

HTML

<canvas id="triangle" width="100" height="100">
    <img src="fallback-triange.png" alt="A triangle">
</canvas>

JavaScript

var t_can = document.getElementById("triangle");

if (t_can.getContext) {
    var t_con = t_can.getContext('2d');

    t_con.fillStyle = "#000";
    t_con.shadowBlur = 10;
    t_con.shadowColor = "#000";

    // Draw a triangle
    t_con.beginPath();
    t_con.moveTo(20, 20);
    t_con.lineTo(20, 80);
    t_con.lineTo(80, 20);
    t_con.lineTo(20, 20);
    t_con.fill();
    t_con.closePath();
}