Remember that by default your div will fill in any available width, so it will not necessarily be the same size as the canvas.
I don't think Raphael allows you to do this directly, but here you can do it with jQuery:
$('div#drawing').find('> svg,div').css({'border': '1px solid #f00'});
Or you can just use CSS in the same way:
div#drawing svg, div#drawing div {
border: 1px solid #f00;
}
source
share