Why are some of my lines in svg thicker than others?
All of them are on whole number coords. "stroke-width: 0.5" was my last attempt to create 1px line. I had tryed also elsewhere mentioned shape-rendering: crispedges with stroke of 1 pixel but with same setup those lines which appears thicker on image were straight 2px instead of 1. I would love to fix that somehow but even knowledge about how its determined which lines get thicker by what rule would be very appretiated. I dont understand why its so hard to make consistent 1px thick line using svg.
My code:
#my-svg {
width : 500px;
height: 500px;
margin: .5em;
}
#my-svg line {
stroke:black;
stroke-width:0.5;
}
<svg id="my-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
<line x1="0" y1="26" x2="380" y2="26" ></line>
<line x1="0" y1="52" x2="380" y2="52" ></line>
<line x1="0" y1="78" x2="380" y2="78" ></line>
<line x1="0" y1="104" x2="380" y2="104"></line>
<line x1="0" y1="130" x2="380" y2="130"></line>
<line x1="0" y1="156" x2="380" y2="156"></line>
<line x1="0" y1="182" x2="380" y2="182"></line>
<line x1="40" y1="0" x2="40" y2="182"></line>
<line x1="240" y1="0" x2="240" y2="182"></line>
<line x1="300" y1="0" x2="300" y2="182"></line>
<line x1="380" y1="0" x2="380" y2="182"></line>
</svg>
Example when using stroke-width: 1 and shape-rendering: crispedges: