I have a triangle (JSFiddle) using this CSS:
.triangle { width: 0; height: 0; border-top: 0; border-bottom: 30px solid #666699; border-left: 20px solid transparent; border-right: 20px solid transparent; }
And this HTML:
<div class="triangle"></div>
This makes a triangle, but the diagonal lines are jagged and pixelated. How can I make them smooth? (I was able to smooth them out in Safari and Chrome by making them dotted, but that broke the triangles in Firefox and IE.)
Method 1.Use SVG's polygon tag <polygon> generate a triangle, and use SVG's stroke-linejoin="round" generate rounded corners at the connection. Here, it is actually the rounded corners generated stroke-linejoin: round attribute of the SVG polygon.
triangle element and pointer-events: auto; on the pseudo-elements). Otherwise, this could be achieved by wrapping . triangle in an element having the same width and height (and the same border-radius ) and overflow: hidden; .
For Firefox you can add -moz-transform: scale(.9999); to make smooth edges. In your case:
.triangle { width: 0; height: 0; border-top: 0; border-bottom: 30px solid #666699; border-left: 20px solid transparent; border-right: 20px solid transparent; -moz-transform: scale(.9999); }
Will do the trick.
I have just stumbled upon the same problem, and figured out this trick (at least, it works on a Mac):
-webkit-transform: rotate(0.05deg); -moz-transform: scale(1.1); -o-transform: rotate(0.05deg); /* Didn't check Opera yet */ transform: rotate(0.05deg);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With