HTML Formatting

2/18/2024By Tony

Share article
Report article

We often make text highlighted, bolded, underline, or italic to emphasize important text. This article will tell you how to format text in HTML.

Some formatting tags example:

HTML
Output

So it's pretty clear what tag is for. Every formatting tag has a closing tag and the text inside them is formatted. You can also put a pair of formatting tags inside another pair of formatting tags so a text can be like this or this.

You may already noticed some formatting tags have the same output like <b> and <strong> tags or <i> and <em> tags. Yes, they are exactly same. You can open VS Code and explore all these formatting tags yourself. If you want to make the formatting output different, you can also use CSS to style the output.

Bonus: HTML Comment

Having comments in your code can have many purposes, like noting what a section of code is for, jot down ideas, explain code, or temperoraily making content invisible. To do this in HTML, simply follow the example below:

HTML
Output

To add a comment in HTML, just type a less than symbol (<), followed by an exclamation mark (!) with two hyphens (--) behind it. To close the comment, type two hyphens (--) and put a greater than tag (>) to close it. Comments are not visible in the HTML output, but is visible in the code.