Semantics refers to the correct interpretation of the meaning of a word or sentence. To use a word semantically is to use it in a way that properly aligns with the meaning of the word. Many HTML tags have semantic meaning. That means that certain HTML elements convey some information about the type of content contained between the opening and closing tags.
In order to write HTML with semantic markup, two rules must take place:
- HTML elements must be used for their intended purpose.
- Content and presentation must be separated.
This means that we do not focus on styling in the HTML. In previous versions of HTML, styling took place in the actual HTML code. This meant that certain elements were chosen to create a web page based on how they looked in a browser rather than to define the content within them.
Modern practices want HTML and CSS to be separated, allowing for semantic markup to take place in the HTML and styling to take place in the CSS. This creates understandable web pages for both users and computer programs that may view the pages as well.