JSFiddle - React, Tailwind, and code Playground
HTML
<svg width="100" height="100">
<line x1="0" y1="40" x2="200" y2="40" style="stroke:rgb(255,0,0);stroke-width:20"/>
Sorry, your browser does not support inline SVG.
</svg>
JavaScript
const line = document.querySelector("svg line");
console.log(line)
console.log(line.getBBox({"stroke": true}))