You often hear developers talk about the importance of semantics, but do you know what “semantic” means? I’ve noticed that it tends to be an arbitrary word that’s thrown around the web by people trying to sound smart (I’m guilty of that too). You often hear that semantics are good for SEO and essential for proper and clean code, but what exactly is semantic code?
Semantics literally means description or meaning. Writing semantic code means writing code that’s self-describing, so that little comments are needed. To have semantic code, you need to properly name your IDs, classes, images and other items as descriptive as possible. (For example: “left sidebar”). Semantics also means that you use the code properly, i.e. styles go in CSS and not in HTML.
