HTML text formatting


HTML Text Formatting

In the previous lessons, you learned about the HTML style attribute.

HTML also defines special elements for defining text with a special meaning.

HTML uses elements like <strong> and <i> for formatting output, like bold or italic text.

Formatting elements were designed to display special types of text:



                    <p>You can use the mark tag to <mark>highlight</mark> text.</p>
                    <p><del>This line of text is meant to be treated as deleted text.</del></p>
                    <p><s>This line of text is meant to be treated as no longer accurate.</s></p>
                    <p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
                    <p><u>This line of text will render as underlined</u></p>
                    <p><small>This line of text is meant to be treated as fine print.</small></p>
                    <p><strong>This line rendered as bold text.</strong></p>
                    <p><em>This line rendered as italicized text.</em></p>
                
                

Live preview

You can use the mark tag to highlight text.

This line of text is meant to be treated as deleted text.

This line of text is meant to be treated as no longer accurate.

This line of text is meant to be treated as an addition to the document.

This line of text will render as underlined

This line of text is meant to be treated as fine print.

This line rendered as bold text.

This line rendered as italicized text.


Examples


                    <strong>This text is strong</strong>
                

Live preview

This text is normal

This text is strong

                      <i>This text is italic</i>
                  

Live preview

This text is normal

This text is italic

                        <em>This text is emphasized</em>
                    

Live preview

This text is normal

This text is emphasized

                          <p>HTML <small>Small</small> Formatting</p>
                      

Live preview

This text is normal

HTML Small Formatting


                            <p>HTML <mark>Marked</mark> Formatting</p>
                        

Live preview

This text is normal

HTML Marked Formatting


                      <p>My favorite color is <del>blue</del> red.</p>
                          

Live preview

This text is normal

My favorite color is blue red.


                        <p>My favorite <ins>color</ins> is red.</p>
                            

Live preview

This text is normal

My favorite color is red.


Rate this lesson

Previous lesson Next lesson

Spread the word:
Do you need help? Use our support forum

About the author

User avatar
Michal Szymanski
Co-Founder at MDBootstrap & BrandFlow. Entrepreneur, web developer, UI/UX designer, marketing analyst. Dancer and nerd in one.