I have two data URIs that come with one of the free website templates. Both of them make up the mobile menu slider icon. My goal is to try to get the mobile menu slider icon to have round ends using the stroke-linecap: round attribute.
How do I achieve that? I have tried putting in between the stroke attributes and using ‘round’ with apostrophes. Also tried with %3B and nothing seems to populate.
Here is the code for your reference (both are same, just different colors):
I’m not an svg expert so I can’t answer your question with the method you want but I can tell you that I was able to do what you want with some fairly simple CSS. Not saying this is a better solution. Just another option if you don’t get an svg answer here.
I think the reason your changes weren’t having an effect is that the line elements currently stretch the full width of the SVG viewport (width 100 per the viewBox attribute).
Rounding the ends adds a radius, so it needs a little extra space at each end i.e. on the horizontal x-axis.
I’ve created a codepen - it’s just your data URI represented as regular html .
You can see that I’ve added the stroke-linecap property and also changed the x1 and x2 values to move the left/right ends of the lines slightly inwards.
You can use that to experiment with the x1/x2 values.
You can add the stroke-linecap property to the styles in your data URI as: stroke-linecap: round%3B