I'd like to find the cheapest (CPU-wise) way to draw arbitrary-length and -width lines in HTML/CSS/Js. I have a case where my page will render 50-200 lines of this kind on a page in addition to other HTML elements. Approaches that have occured to me are:
- SVG. One for a horizontal line, one for a vertical one. Use Javascript to inject and render them by parameters.
- Canvas. One canvas that covers the entire screen with transparent background.
- DIV-tags with
border-left
/border-top
. Abstract through Javascript-methods.
Other suggestions? Which one would perform best? Any compatibility issues with either of these approaches?