Exemple div avec SVG et Bordures
by ysis81
HTML
<div id="containerCanvas">
</div>
CSS
#containerCanvas{
position: relative;
top: 0;
left: 0;
margin: 30px;
width: 200px;
height: 200px;
border-style: solid;
border-width: 2px;
background-color: grey;
}
JavaScript
var svgNS = "http://www.w3.org/2000/svg";
var x=15;
var y=20;
var svgEl = document.createElementNS(svgNS,"svg");
svgEl.setAttributeNS(null,"height",200);
svgEl.setAttributeNS(null,"width",200);
var newText = document.createElementNS(svgNS,"text");
newText.setAttributeNS(null,"x",x);
newText.setAttributeNS(null,"y",y);
newText.setAttributeNS(null,"font-size","20");
newText.setAttributeNS(null,"fill","black");
newText.innerHTML = "Need help";
svgEl.appendChild(newText);
document.getElementById("containerCanvas").appendChild(svgEl);