I have an arrow as a SVG which\'s length I want to alter in response to the width of a wrapping DIV (for example).
All my previous attempts have led into this behavior (
For this particlular usecase, I think I would go for a CSS approach, it might (depending on your markup) add a html element if you can't use pseudo elements but it won't require JS or to manualy input values for stroke-width or transform elements.
Here is a way to make this arrow using the paragraph tag :
p {
position: relative;
max-width: 300px;
border-bottom: 4px solid #5FDBC6;
padding-bottom:6px;
}
p:nth-child(2) {max-width: 400px;}
p:nth-child(3) {max-width: 200px;}
p::before, p::after{
content:'';
position:absolute;
bottom:-8px;
}
p::before {
height: 12px;
left:0;
border-left: 4px solid #5FDBC6;
}
p::after{
right:-4px;
border-style:solid;
border-width:6px 0 6px 8px;
border-color:transparent transparent transparent #5FDBC6;
}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. a dapibus, tincidunt velit eget, rutrum urna.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in purus risus. Ut id est suscipit, tincidunt sem a, fermentum magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut rutrum ac ligula
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in purus risus. Ut id est suscipit, tincidunt sem a, fermentum magna.