# Drawing a line between 2 points using CSS

A nearly pure css line joining 2 points defined by Pt1($ox, $oy) and Pt2($ex, $ey)

Since sqrt is not supported yet, the length of the line is determined using sass:math, while the slope is completely computed using pure vanilla CSS.

calculating length = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))

calculating angle = atan2(y2 - y1, x2 - x1)

When using Javascript , you would have to use the equation angle = atan2(y2 - y1, x2 - x1) * 180 / ℼ as atan2 in JS is calculated into radians where as in css it is in degrees.

Change $ox, $oy, $ex, and $ey to change the dimensions of the above triangle.

Extrapolated here drawing a triangle between 3 points pen which uses this to draw 3 line between 3 points to make a triangle