Are icons content?
Edd Morgan writes in:
Obviously we all agree that the markup should contain only content, nothing ornamental. But what category do icons fall into? Are they not ornamental, therefore should not exist in the markup and be defined purely in CSS?
I’m sure we can imagine an “ornamental” icon. I’d wager it’s the most common type. It accompanies a word or phrase as part of the design. I don’t have scientific papers to cite here, but I imagine they would tell us it can make a thing more memorable or findable or distinguishable or cross-culturally relevant or whatever.
Here’s one:
Let’s build it like the quote in Ed’s question: “therefore should not exist in the markup and be defined purely in CSS”.
<button class="button button-follow">
Follow
</button>
.button-follow {
padding-left: 70px; /* Normal left padding plus space for icon */
background: url(/images/icons/icon-follow.svg) no-repeat left center;
}
There is nothing in the HTML specifically about the icon. Purely ornamental. It would still be a button if that image failed to load, or even if the CSS failed to load, and it certainly doesn’t depend on any JavaScript. If we’re being perfect progressive enhancement citizens here, we’d make sure that is wrapped in a