Difference between revisions of "Semantic HTML"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Examples)
Line 13: Line 13:
 
The CSS stylesheet should then specify whether emphasis is denoted by an italic font, a bold font, underlining, slower or louder audible speech, etc.
 
The CSS stylesheet should then specify whether emphasis is denoted by an italic font, a bold font, underlining, slower or louder audible speech, etc.
  
This is because italics are used for purposes other than emphasis, such as citing a source; for this, HTML provides the <pre><cite></pre> element.
+
This is because italics are used for purposes other than emphasis, such as citing a source; for this, HTML provides the <code><cite></code> element.
  
 
Another use for italics is foreign phrases or loanwords; web designers may use built-in [[XHTML]] [[language attributes]] or specify their own [[semantic markup]] by choosing [[appropriate names]] for the [[class attribute values]] of [[HTML element|HTML elements]] (e.g. class="loanword").
 
Another use for italics is foreign phrases or loanwords; web designers may use built-in [[XHTML]] [[language attributes]] or specify their own [[semantic markup]] by choosing [[appropriate names]] for the [[class attribute values]] of [[HTML element|HTML elements]] (e.g. class="loanword").

Revision as of 08:46, 30 August 2015

Semantic HTML is the use of HTML markup to reinforce the semantics, or meaning, of the text in web pages and web applications, rather than merely to define its presentation or look.

Description

Semantic HTML is processed by traditional web browsers as well as by many other user agents. CSS is used to suggest its presentation to human users.

Examples

As an example, recent HTML standards discourage use of the italic tag:
<i>
:

The emphasis tag is semantically more accurate:

<em>

The CSS stylesheet should then specify whether emphasis is denoted by an italic font, a bold font, underlining, slower or louder audible speech, etc.

This is because italics are used for purposes other than emphasis, such as citing a source; for this, HTML provides the </code> element.

Another use for italics is foreign phrases or loanwords; web designers may use built-in XHTML language attributes or specify their own semantic markup by choosing appropriate names for the class attribute values of HTML elements (e.g. class="loanword").

Marking emphasis, citations and loanwords in different ways makes it easier for web agents such as search engines and other software to ascertain the significance of the text.

See also

External links