Earlier quoted context omitted.
Actually I'd use SVG for that, it's even trivial to write: Should be supported pretty much everywhere canvas is, but without the need of scripting to actually get a triangle.
But that's hardly reusable. You'll have to copypaste the (completely nonobvious) markup everywhere you want a triangle. Although it might be possible to use the CSS :before pseudo-element...
Animation to Explain CSS Triangles
61–70 of 107 posts
Re: Animation to Explain CSS Triangles
#62Earlier quoted context omitted.
It'd be even more awesome if you could actually make complex shapes with these triangles.
You can. It just requires absolute positioning. I can't see why you'd want to though, it's not hard enough to be fun or useful enough to be work.
Re: Animation to Explain CSS Triangles
#63Honestly, why is there no basic web drawing app out there that exports to CSS? Should be doable and hence done.
Re: Animation to Explain CSS Triangles
#64▼ ◀ ▶ ▲ Some more - http://www.fileformat.info/info/unicode/block/geometric_shap...
Better site for this, IMO.
Re: Animation to Explain CSS Triangles
#65Earlier quoted context omitted.
It's the only way to do it with pure CSS. A more sane approach would be to use a raster or vector image. It is pretty silly.
It is a bit insane, however this allows you to change the color, dimensions, transparency at runtime. A raster doesn't allow you to do this, and, while SVG is scriptable, browser support is spotty. This hack on the other hand will work in every browser all the way back to Netscape Navigator or earlier.
Re: Animation to Explain CSS Triangles
#66Designer: "wow this is cool" HN reader who's not a designer: "don't like, bleh CSS, should SVG, used to do that in VIM, TIMTOWTDI" and other similar useless rants missing the point.
Re: Animation to Explain CSS Triangles
#67Earlier quoted context omitted.
Touche. The sooner people realize the web is a presentation thing the sooner we can get our sanity back. sadly, we will see some dozen iterations of 'flash' until that day finally comes. and html5 js shenanigans are only the third...
...and all those impaired people and people with old and slow devices are finally locked out of our new shiny "sane" web. The web isn't just one visual presentation layer, its a multitude of presentation layers for all kind of people and that demands some compromise.
Re: Animation to Explain CSS Triangles
#68Earlier quoted context omitted.
It is a bit insane, however this allows you to change the color, dimensions, transparency at runtime. A raster doesn't allow you to do this, and, while SVG is scriptable, browser support is spotty. This hack on the other hand will work in every browser all the way back to Netscape Navigator or earlier.
Better to use Arial unicode characters like ▲ or ▼ ASCII encodings and UTF-8 More logical and you can apply all the text styling like color, shadows, skewing, rotate, jquery prepends etc. Put it inside a div and it can go it wherever you want. And it wouldn't be a hack. Some hacks are awesome.. and others are nice playful things but not to be taken with any kind of serious inquiry.
Re: Animation to Explain CSS Triangles
#69Honestly, why is there no basic web drawing app out there that exports to CSS? Should be doable and hence done.
Re: Animation to Explain CSS Triangles
#70Earlier quoted context omitted.
But that's hardly reusable. You'll have to copypaste the (completely nonobvious) markup everywhere you want a triangle. Although it might be possible to use the CSS :before pseudo-element...
SVG has `symbol` and `use` for reusing stuff: http://www.w3.org/TR/SVG/struct.html#SymbolElement