HTML CSS JAVASCRIPT PYTHON JAVA

HTML Formatting

HTML formatting elements are used to define how text should appear on a web page. These elements allow you to highlight important content, emphasize text, and improve readability for users.

HTML <b> and <strong> Elements

The <b> element makes text bold without adding extra importance.

Example
<!DOCTYPE html> 
<html>
<body>

<b>This is bold text</b>

</body>
</html>
Try this code

The <strong> element represents important text and is also bold.

Example
<!DOCTYPE html> 
<html>
<body>

<strong>This is important text</strong>

</body>
</html>
Try this code

HTML <i> and <em> Elements

The <i> element displays text in italic style without emphasis.

Example
<!DOCTYPE html> 
<html>
<body>

<i>This is italic text</i>

</body>
</html>
Try this code

The <em> element emphasizes text and is typically displayed in italics.

Example
<!DOCTYPE html> 
<html>
<body>

<em>This is emphasized text</em>

</body>
</html>
Try this code

HTML <u> Elements

The <u> element underlines text. It should be used carefully because underlined text is often confused with links.

Example
<!DOCTYPE html> 
<html>
<body>

<u>This is underlined text</u>

</body>
</html>
Try this code

HTML <small> Elements

The <small> element defines smaller text, often used for notes or disclaimers.

Example
<!DOCTYPE html> 
<html>
<body>

<small>This is small text</small>

</body>
</html>
Try this code

HTML <mark> Elements

The <mark> element highlights text with a background color.

Example

<!DOCTYPE html> 
<html>
<body>

<mark>This is highlighted text</mark>

</body>
</html>
Try this code

HTML <del> and <ins> Elements

The <del> element shows deleted text, usually displayed with a line through it.

Example
<!DOCTYPE html> 
<html>
<body>

<del>This is deleted text</del>

</body>
</html>
Try this code
The <ins> element shows inserted text, often underlined.
Example
<!DOCTYPE html> 
<html>
<body>

<ins>This is inserted text</ins>

</body>
</html>
Try this code

HTML <sub> Elements

The <sub> element displays text as subscript.

Example
<!DOCTYPE html> 
<html>
<body>

<sub>This is subscripted text</sub>

</body>
</html>
Try this code

HTML <sup> Elements

The <sup> element displays text as superscript.

Example
<!DOCTYPE html> 
<html>
<body>

<sup>This is superscripted text</sup>

</body>
</html>
Try this code

Formatting Best Practices

Common Formatting Mistakes