Inline semantic text
Use inline semantic text to define the meaning, structure, or style of a word, line, or any arbitrary piece of text.
Abbreviation
The abbr
element is used for any abbreviated text, whether it be acronym, initialism, or otherwise. Generally, it's less work and useful (enough) to mark up only the first occurrence of any particular abbreviation on a page, and ignore the rest. Any text in the title
attribute will appear when the user's mouse hovers the abbreviation. Example abbreviations:
Pre-formatted text
The pre
element represents a block of pre-formatted text, in which structure is represented by typographic conventions rather than by elements. Such examples are an e-mail (with paragraphs indicated by blank lines, lists indicated by lines prefixed with a bullet), fragments of computer code (with structure indicated according to the conventions of that language) or displaying ASCII art. Here's an example showing the printable characters of ASCII:
Emboldened
The b
element is used for text stylistically offset from normal prose without conveying extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typographic presentation is typically emboldened. Example:
Citations
The cite
element is used to represent the title of a work (e.g. a book, essay, poem, song, film, TV show, sculpture, painting, musical, exhibition, etc). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can just be a work that is mentioned in passing. Example:
Code
The code
element is used to represent fragments of computer code. Useful for technology-oriented sites, not so useful otherwise. Example:
Used in conjunction with the pre
element:
Definition
The dfn
element is used to highlight the first use of a term. The title
attribute can be used to describe the term. Example:
Stressed emphasis
The em
element is used to denote text with stressed emphasis, i.e., something you'd pronounce differently. Where italicizing is required for stylistic differentiation, the i
element may be preferable. Example:
Horizontal rule
The hr
element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book. The following extract from Pandora's Star by Peter F. Hamilton shows two paragraphs that precede a scene change and the paragraph that follows it:
Inline quotes
The q
element is used for quoting text inline. Example showing nested quotations:
Italicised
The i
element is used for text in an alternate voice or mood, or otherwise offset from the normal prose. Examples include taxonomic designations, technical terms, idiomatic phrases from another language, the name of a ship or other spans of text whose typographic presentation is typically italicised. Example:
Keyboard entry
The kbd
element is used to denote user input (typically via a keyboard, although it may also be used to represent other input methods, such as voice commands). Example:
Marked or highlighted text
The mark
element is used to represent a run of text marked or highlighted for reference purposes. When used in a quotation it indicates a highlight not originally present but added to bring the reader's attention to that part of the text. When used in the main prose of a document, it indicates a part of the document that has been highlighted due to its relevance to the user's current activity. Example:
Strikethrough
The s
element is used to represent content that is no longer accurate or relevant. When indicating document edits i.e., marking a span of text as having been removed from a document, use the del
element instead. Example:
Sample output
The samp
element is used to represent (sample) output from a program or computing system. Useful for technology-oriented sites, not so useful otherwise. Example:
Small print
The small element is used to represent disclaimers, caveats, legal restrictions, or copyrights (commonly referred to as ‘small print'). It can also be used for attributions or satisfying licensing requirements. Example:
Strong importance
The strong
element is used to denote text with strong importance. Where bolding is used for stylistic differentiation, the b
element may be preferable. Example:
Superscript and subscript text
The sup
element represents a superscript and the sub element represents a sub
. These elements must be used only to mark up typographical conventions with specific meanings, not for typographical presentation. As a guide, only use these elements if their absence would change the meaning of the content. Example:
Time
The time
element is used to represent either a time on a 24 hour clock, or a precise date in the proleptic Gregorian calendar, optionally with a time and a time-zone offset. Example:
Variable
The var
element is used to denote a variable in a mathematical expression or programming context, but can also be used to indicate a placeholder where the contents should be replaced with your own value. Example: