HTML - A semantic way to display images / icons / user interface elements?

Is it true that there are semantically correct and incorrect ways to display images / icons?
 I mean, of course, it’s not very nice to include all the photographs of a newspaper article as background images, because in this way screen readers cannot read the text alt, but what about the icons or user interface elements? Is it justifiable from a semantic oriented point of view to include them as background images?

+5
source share
2 answers

There are several semantically correct and incorrect ways to display different types of images.

  • Regular Images It is better to use standard tags <img>, because they are often the main content of the site. They must have tags altto inform users about important parts of the content.
  • Icons - this is not an image that is not the main content of your site, but should also be displayed using tags <img>, because it is important for convenience to show specific icons if it does not display correctly.
  • Non-important photos that make the site pleasant and are not the main content of the site should be displayed as a background, because then you are not using unnecessary nodes in your site DOM.
+6

, , ; a img i.

- , , . a button. , -. , .

- /. . . , .

, , .

+2

All Articles