Read my book

I wrote books about Webpack and React. Check them out!

Tuesday, March 29, 2011

CSS Triangles

Ever wondered how to draw triangles using just CSS? Even if you didn't, here's how to do it.

CSS:



Markup:



It's just a matter of (ab)using CSS opacity. I came by this trick while researching how to implement a popover using JavaScript.

You can find a live demo at jsFiddle in case you want to give it a go.