HTML Formatting Elements Made Simple: With Easy And Practical Examples

Marilena

By Marilena

7 min read
Bookmark this post

We often format HTML elements using CSS but can achieve basic text formatting using only HTML. Below are some of the most common HTML formatting elements for text and layout. I also prepared some examples for better understanding.

HTML Elements – Text Formatting

bold

<b>...</b>

<div>I am a <b>bold</b> text</div>
HTML
HTML formatting elements: An image showing a purple box with the sentence 'I am a bold text'. The word bold is formatted in bold.

strong

<strong>...</strong>

<div>I am a <strong>strong</strong> text</div>
HTML
An image showing a purple box with the sentence 'I am a strong text'. The word strong is formatted in strong.

📢 Bold VS Strong

As we can see below <bold> and <strong> look exactly the same. The difference is that we use strong when we have to show an important text and bold when we want just to pay attention to the text, something like highlighting.

<div>I am a <b>simple</b> text BUT i am an <strong>important</strong> text!!</div>
HTML
An image showing a pink box with the sentence 'I am a simple text BUT I am an important text'. The word simple is formatted in bold and the word important is formatted in strong.

italic

<i>...</i>

<div>I am an <i>italic</i> text</div>
HTML
An image showing a purple box with the sentence 'I am an italic text'. The word italic is formatted in italic.

emphasized

<em>...</em>

<div>I am an <em>emphasized</em> text</div>
HTML
An image showing a purple box with the sentence 'I am an emphasized text'. The word emphasized is formatted in emphasized.

📢 Italic VS Emphasized

Formatting italic <i> and emphasized <em> appear in the exact same way. We use emphasized when we want to give emphasis to the text and italic when we want to present different our text.

<div>I am an <i>italic</i> text BUT i am an <em>emphasized</em> text!!</div>
HTML
An image showing a pink box with the sentence 'I am an italic text BUT I am an emphasized text'. The word italic is formatted in italic and the word emphasized is formatted in emphasized.

underline

<u>...</u>

<div>I am an <u>underline</u> text</div>
HTML
An image showing a purple box with the sentence 'I am an underline text'. The word underline is formatted in inderline.

deleted

<del>...</del>

<div>I am a <del>deleted</del> text</div>
HTML
An image showing a purple box with the sentence 'I am a deleted text'. The word deleted is formatted in deleted.

marked

<mark>...</mark>

<div>I am a <mark>marked</mark> text</div>
HTML
An image showing a purple box with the sentence 'I am a marked text'. The word marked is formatted in marked as hypertext.

big

<big>...</big>

<div>I am a <big>big</big> text</div>
HTML
An image showing a purple box with the sentence 'I am a bid text'. The word big is formatted in big which means it has bigger font-size than the rest of the words.

small

<small>...</small>

<div>I am a <small>small</small> text</div>
HTML
An image showing a purple box with the sentence 'I am a small text'. The word small is formatted in small which means it has smaller font-size than the rest of the words.

superscript

<sup>...</sup>

<div>I am a superscripted text: a<sup>2</sup> X a<sup>2</sup> = a<sup>2 + 2</sup></div>
HTML
An image showing a purple box with the sentence 'I am a supscripted text: a2 X a2 = a2 + 2'. Number 2 are all formatted in superscripted.

subscript

<sub>...</sub>

<div>I am a subscripted text: H<sub>2</sub>O</div>
HTML
An image showing a purple box with the sentence 'I am a subscripted text: H2O'. The number 2 is formatted in subscripted.

HTML Elements – Layout Formatting

We can use two tags in HTML to manipulate our document’s layout. Break Line tag <br/> which inserts a new line by adding the tag wherever we want to force the text to break and the Horizontal row tag <hr/> which is used if we want to add space between HTML elements.
There are both self-closing tags as they are empty elements.

break line

<br>

<div>This is a sentence which <br>forced to break in two lines!!</div>
HTML
An image showing a purple box with the sentence 'This is a sentence which forced to break in two lines'. The sentence is separated into two lines.

💡 A common practice for adding a new line is using the break line tag, which is helpful If we want to write an address.

<div>Jane Doe<br/>Champs-Élysées Avenue<br/>Paris - France</div>
HTML
An image showing a purple box with an adress. The adress is separated into three lines. Jane Doe in the first line Champs-Elysees Avenue in the second line and Paris-France in the third line.

horizontal row

<hr>

<h2>Chapter 1</h2>
<p>Here goes text for chapter 1</p>
<hr/>
<h2>Chapter 2</h2>
<p>Here goes text for chapter 2</p>
HTML
This image shows how we separate two chapters with a horizontal row among them.

💡 Remember, If you want to apply extra styling, you have to use 🔓 CSS instead! HTML is used as a markup language, whereas CSS is the one responsible for making something more beautiful 😄).

🌼 Hope you found my post interesting and helpful. Thanks for being here! 🌼

DigitalOcean Referral Badge
Tags
guest
0 Comments
Inline Feedbacks
View all comments

Continue reading

Front, Programming

What You Need to Know About CSS nth child Selector – A Practical Guide

Front, Programming

Learn How to Select Only the CSS First Child

Front, Programming

Grayscale Backdrop Filter: A Useful Tool To Make Grayish Backgrounds

Front, Programming

How To Calculate CSS Line Height

Front, Programming

Coding Made Easy With CSS Selectors: An Ultimate Guide

Front, Programming

Most Useful HTML Elements for Maximizing Better Results

Front, Programming

CSS Box Sizing – Better Implementations, Less Headaches

Front, Programming

What Is the CSS Box Model in Simple Terms

Front, Programming

CSS Text Decoration In Action: A Powerful Guide

Front, Programming

How To Be Creative With Different CSS Border Styles

Front, Programming

How To Work With CSS Syntax: The Correct Way!

Front, Programming

What You Need to Know About CSS Color Methods

Subscribe to our newsletter

Dive into the Fun Side of Tech! Posts, News, and More Delivered to Your Inbox!

Intuit Mailchimp