Text is the basic component in an HTML web page. The text can be formatted to suit different styles or to stand out. In this tutorial you will learn exactly how to format text in HTML on your web pages. Basic and most commonly used while formatting text in html includes; bold, italic, citation, subscript, superscript, and code.
Step # 1 – Formatting 101
All Formatting text in html is done through dedicated elements. The bold element is used to bold the text written between its starting and ending tags. The italic element works exactly the same, and slants the text written between its starting and ending tags.
b This is a bold text /b
i This is an italic text /i
The browser responds to these declarations by bolding the text between the bold tags, and tilting the text between the italic tags.
Step # 2 – Further formatting
Among other formatting, the citation element produces the same result as the italic, but it is explicitly used when quoting a chunk of text. The change in element name proclaims the reason of use for each element even though the results are similar. This is useful to the designer instead of the user that is visiting the web page. The element for citation is shown below; the use of this element is similar as of bold and italic elements:
cite This is a cited text /cite
The code element in HTML works differently to the cite element. This element is used to quote computer code. The font and style changes accordingly when this element is used. Below is a declaration of the code element:
code This is a computer code /code
HTML also includes elements to change a normal text to either subscript or superscript. The code below shows the elements in use:
This is sub subscript /sub
This is sup superscript /sup
That’s all for how to format text in HTML.