Reputation: 2210
.rect-x {
fill: red;
}
.rect-y {
fill: pink;
}
<svg viewBox="0 0 1024 768">
<rect class="rect-x" x="0" y="0" width="100" height="100"></rect>
<rect class="rect-y" x="0" y="0" width="100" height="100"></rect>
</svg>
Screenshot of the issue:
why this is happen?
how can i handle it?
Upvotes: 1
Views: 118
Reputation: 123428
Try to turn off the antialias rendering on the SVG
svg {
shape-rendering: crispEdges;
}
.rect-x {
fill: red;
}
.rect-y {
fill: pink;
}
svg {
shape-rendering: crispEdges;
}
<svg viewBox="0 0 1024 768">
<rect class="rect-x" x="0" y="0" width="100" height="100"></rect>
<rect class="rect-y" x="0" y="0" width="100" height="100"></rect>
</svg>
Upvotes: 2
Reputation: 20953
Try adding shape-rendering="crispEdges"
to disable antialiasing
.rect-x {
fill: red;
}
.rect-y {
fill: pink;
}
<svg viewBox="0 0 1024 768">
<rect class="rect-x" x="0" y="0" width="100" height="100"></rect>
<rect class="rect-y" x="0" y="0" width="100" height="100"></rect>
<rect class="rect-x" x="200" y="0" width="100" height="100" shape-rendering="crispEdges"></rect>
<rect class="rect-y" x="200" y="0" width="100" height="100" shape-rendering="crispEdges"></rect>
</svg>
Upvotes: 2