+ 4
what's idea in draw line by html?
2 Respostas
0
Use <hr>
0
Use <svg><line></svg></line> to draw any straight line on html page.
<svg width="300" height="300">
<line x1="50" y1="50" x2="250" y2="250" stroke="#000" stroke-width="2" />
</svg>
where attributes
x1 - Defines the x-axis coordinate of the line starting point.
Value type: <length>|<percentage>|<number> ;
x2 - Defines the x-axis coordinate of the line ending point.
Value type: <length>|<percentage>|<number> ;
y1 -Defines the y-axis coordinate of the line starting point.
Value type: <length>|<percentage>|<number> ;
y2 - Defines the y-axis coordinate of the line ending point.
Value type: <length>|<percentage>|<number> ;
stroke - Defines color of stroke line
stroke-width - Defines the width of the stroke line
https://code.sololearn.com/WeHpRQ2Z8x6e/?ref=app
Beside svg line, we can also use svg polygon or svg path to draw more complex lines.
More examples
https://code.sololearn.com/WhaIIH7azwqG/?ref=app
https://code.sololearn.com/W5MY8rcpq3E0/?ref=app