Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Rendering icons. What's best?

I found Toms post on the css heart here:... wow look at tom's heart

Made me think of a related question:

In a perfect world; what would be the best way to draw simple icons for buttons/UI, like the Cog for 'settings', a Bell for 'notifications' or a Speech Bubble for 'forum' like the one on the left here... without using images? More like vectors; quick loading, simple, razor sharp shapes.

Has anyone had experience using tricks like this advanced CSS, SVGs, JS, plugins for turning vectors into canvas elements etc...?

J

ps... I know of @font-face and using custom typefaces to load as icons instead of type but is this a good idea?

1 Answer

Icon fonts (for a bell) and simple CSS shapes (for a speech) bubble are good. However that heart probably wouldn't degrade gracefully for cross-browser support.

It degrades to a lovely pink square.

The CSS heart is more of a "because I could" project, not something to use on an actual site (at least not with current browser usage/support). I agree with James that there are situations where either can be appropriate.

I would use CSS shapes for when are adding something visual that isn't important to the use of the content. For the speech bubble example this is fine as comments would still be understood if they appeared in rectangles rather than bubbles.

For shapes that are important to the interpretation of the content (e.g. menu icons) you should use either images (ideally in a sprite sheet if there are several in order to reduce http requests), or an icon font. If you are using an icon font you should make sure it is accessible.

Tom Bedford -

> It degrades to a lovely pink square.

That made me literally laugh out loud. I think you won the forum for today with that comment.