Formatting Text
Adding some flair to our text
What We'll Be Building!
Formatting Tags
Sometimes we need certain pieces of texts to stand out. To accomplish that, we use formatting to adjust the way these pieces of text look.
One simple way to do that, is through the use of Text Formatting Tags.
Bold and Italic Tags
To apply bold or italic effects onto any text. Simply place it between the bold or italic tags.
The bold tag is written as: <b>
and the italic tag is written as: <i>
<!DOCTYPE html>
<html>
<body>
<p><b>This text is bold</b></p>
<p><i>This text is italic</i></p>
<p><b><i>This text is bold and italic</i></b></p>
<p><b>This text is bold</b> and </i>this is italic</i></p>
<p>This is <sub>subscript</sub> and <sup>superscript</sup></p>
</body>
</html>
Exercises
Create a new html tag named formatting.html. Using the code above as a guide:
Apply the bold effect to an entire paragraph. Refresh the page too see the results.
Apply the italic effect to an entire paragraph.
Apply the bold and italic effect to an entire paragraph.
Write the words 'Hello World' in a paragraph tag. Apply the bold effect to only the word 'Hello', apply the italic effect to only the word 'World'.
Last updated
Was this helpful?