Icons are tiny pictures that do a job: search, cart, settings. They save space and people spot them fast, but only if everyone can tell what they mean. Here are three ways to put one on a page:
🔤 1. Icon font + CDN
Add one line to your <head>, then use an <i> tag with the icon’s class. It works like text, so font-size and color style it. This page uses Bootstrap Icons.
Pick an icon, change its size and colour, then check: is it big enough to tap, and can people see it?
Icon
Colour
② Make them accessible
Some people use a screen reader: software that reads the page out loud. It can’t see your icon, so you have to tell it what the icon means. Here are the rules:
🙈 Decoration? Hide it.
If there’s text right next to the icon, the icon is just decoration. Hide it from screen readers with aria-hidden="true" so it isn’t read twice.
WCAG 2.2 says tap targets must be at least 24×24px. 44×44px is even better for fingers. Add padding to small icon buttons.
🌗 Easy to see
Icons that carry meaning need a contrast of at least 3:1 against the background. Try it in the tinkerer above! And remember: a hover-only title tooltip is not a label.
🔊 What does a screen reader hear?
Same-looking button, five different codes. Press 🔊 Hear it to hear roughly what a screen reader would say.
③ What’s this icon for?
10 icons, 4 answers each. Pick your difficulty! After each answer you’ll see the accessible code for that icon. 🧠
Choose your difficulty
⭐ 0🔥 0
What’s this icon for?
This game is visual: the icon is hidden from screen readers on purpose, otherwise it would read out the answer!
④ Icon libraries
Free icon sets used by real developers. Search, copy, done.