I am trying to draw a sharp rectangle using SVG <path>.
I have a problem that the top and bottom edge of the shape have an unexpected antialiasing when rendered in IE and Edge. The problem happens only if the <path> element is preceded by another element that has dimensions expressed in different unit than px.
The problem does not appear to <div> or SVG <rect> elements. Only SVG <path> seem to be affected.
I appreciate any help, how do I make the <path> render crisply without changeing the surrounding <div>s?
I can simulate the same problem with a simple SVG object and:
- a native button: https://jsfiddle.net/7btjcy18/
- a font sized with REM units: https://jsfiddle.net/ptzs71ba/
The following screenshot shows the problem. Chrome on the left, Edge on the right. On a zoom, you can see the blurry borders highlighted with the arrows.
#div1 {
font-size: 1.2rem;
margin-bottom: 20px;
}
<div id="div1">REM font size</div>
<svg xmlns="http://www.w3.org/2000/svg">
<path d="M 0 0 L 300 0 L 300 100 L 0 100" />
</svg>

