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>

formatting.html
<!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>

Remember, you can use these tags separ-ately or you can use them together.

Exercises

Create a new html tag named formatting.html. Using the code above as a guide:

  1. Apply the bold effect to an entire paragraph. Refresh the page too see the results.

  2. Apply the italic effect to an entire paragraph.

  3. Apply the bold and italic effect to an entire paragraph.

  4. 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?