HyperText Markup Language/Textual Formatting
As with almost all programming languages and Markup Languages there are several different ways of formatting text. HTML is no exception.
A popular way to format HTML is to use specific HTML tags such as <b>, <i> and <u>. The World Wide Web consortium (W3C) suggest these tags may not be supported in future and that you use <strong>, <em> and <cite> to add formatting to text on the HTML page.
In practice, these methods are both fine to use, but are limited in the ways that text can be formatted.
Thus, many HTML authors are shifting towards using CSS (Cascading Style Sheets) which employs "style sheets" and "inline styles" to add formatting to text. It should be noted that using CSS one can redefine the appearance of text inside all tags of a particular type. See the section on classes below for details.
Inline styles
editThrough CSS (Cascading Style Sheets) you can reuse code using "classes" which contain "styles" (ways of formatting text). You can also put CSS styles inline, as in the following:
<div style="font-weight: bold; font-size: 200%">This is a paragraph of double-size bold text</div>
results in
Classes
editClasses can be defined in two places; in style tags in HTML documents and in external files, the "style sheets" referred to in the name "Cascading Style Sheets". The term "cascading" refers to the mechanism by which the correct style is chosen when multiple style sheets are to be applied to the same document.
An example style tag:
<style type="text/css"> a { font-weight: bold; } a.special { color:red; } </style>
An example of the contents of a style sheet file:
a { font-weight: bold; } a.special { color:red; }