Embedded image permalink

HTML semantics

Semantic HTML or semantic markup is HTML that introduces meaning to the web page rather than just presentation. For example, a

tag indicates that the enclosed text is a paragraph. This is both semantic and presentational, because people know what a “paragraph” is and browsers know how to display them. In HTML4* tags like and are not semantic, because they define only how the text should look (bold or italic) and do not provide any meaning to the text.

Other examples of semantic HTML tags include the header tags

The benefit of writing semantic HTML stems from the goal of a web page—to communicate. And by adding semantic tags to your documents, you are providing additional information about your document, which aids in communication.

Semantic HTML tags provide information about the contents of those tags that goes beyond just how they look on a page. Text that is enclosed in the tag is immediately recognized by the browser as some type of coding language. It is entirely possible that some user agent could create an entire code library just by reading a website's snippets.

In a less futuristic scenario, using semantic tags gives you many more hooks for styling your content. This means that perhaps today you prefer to have your code samples display in the default browser style. But then tomorrow, you want to call them out with a gray background color, and later you want to define the precise mono-spaced font family or font stack to use for your samples.

If you have all your code samples defined with the semnatic tag, this is very easy to do.

Use Semantic Tags Correctly

See also:

Related video
html semantics
html semantics
HTML semantics: making an HTML file
HTML semantics: making an HTML file
HTML - Text Semantics - Technical
HTML - Text Semantics - Technical
Interesting facts
Related Posts