Take the 2-minute tour ×

I am a JavaScript newbie. I know JavaScript can draw lines, but can it draw dashed lines? If it can, how can I do so? Can it draw anti-aliased lines? If so, how?

share|improve this question

2 Answers 2

I think you're looking for RaphaelJS

share|improve this answer
Dotted / Dashed lines in Raphael.js are set via the attr stroke-dasharray - more on that, plus examples, here –  user568458 Dec 15 '12 at 17:27

If it is just drawing lines, why not use CSS border property:

border-top:1px dashed #000;
share|improve this answer
did you mean 1px dashed #000? –  Fabrizio Calderan Sep 26 '12 at 8:10
@FabrizioCalderan: yes dashed/dotted both will work. –  defau1t Sep 26 '12 at 9:02

Your Answer


