HTML tags Cheatsheet

HTML tags Cheatsheet

Headings

There are 6 types of headings in HTML:

h1

h1.PNG

That will look like:

h1 tag.PNG

h2

h2.PNG

That will look like:

h2 tag.PNG

h3

h3.PNG

That will look like:

h3 tag.PNG

h4

h4.PNG

That will look like:

h4 tag.PNG

h5

h5.PNG

That will look like:

h5 tag.PNG

h6

h6.PNG

h6 tag.PNG

Paragraph

the paragraph tag <p></p> creates a paragraph.

p.PNG

In the browser that looks like this:

p tag.PNG

Pre-formatted text

the preformatted tag <pre></pre> creates a preformatted text.

For example if we add a paragraph like the one above, even if we add some space in the editor, once the browser displays the paragraph it removes all the space and keep only the text formatted.

But if we want to display the text as it is, without any formatting from the browser, we'll add the <pre></pre> tag.

For example let's add some text with space:

pre.PNG So in the browser we'll have:

pre tag.PNG As you can see, the text is displayed in the browser as it was written in the editor, with the space and everything.

code

the <code></code> tag is used to tell the user that this part is a code.

For example let's say that you're writing JavaScript code, and by the end of the tutorial you want to leave the JavaScript code to your readers.

So the <code></code> tag will be added like this:

code.PNG So in the browser we have:

code tag.PNG

link to a URL

<a></a> tag creates a link that you want the user to click on and go to.

link image.PNG href is where we add the link.

a tag.PNG

link to an email

<a></a> tag creates also a link to an email.

link email.PNG href is where we add the email.

email tag.PNG Once clicked on the link it will open the email box where you can send an email to "".

email box.PNG

Ordered list

<ol></ol> is the tag to create an ordered list:

ol.PNG <li></li> is where we add the list items.

ol tag.PNG

Unordered list

<ul></ul> is the tag to create an unordered list:

ul.PNG <li></li> is where we add the list items.

description list, description term and description

Let's say that you want to make a glossary and you have a list of terms you want to define.

So this list of terms will be put inside a description list tag: <dl></dl>.

The terms will be put inside a description term tag: <dt></dt>.

And the definition of the terms will be put inside a description tag: <dd></dd>.

description list.PNG In the browser:

dl,dt,dd tags.PNG

Image

<img/> tag is used to add an image.

img.PNG <img/> tag works with src attribute. It is in the src attribute that we specify the source of the image.

Horizontal rule

Horizontal rule is added via <hr/> tag. It is used to separate content between HTML elements. Let's say that we have 2 paragraphs and we want to separate them:

hr.PNG In the browser we have:

hr tag.PNG

Line break

<br/> tag is added to skip the line between 2 lines/elements.

br.PNG In the browser we have:

br tag.PNG

Words emphasis

To emphasize a word we can either use <strong></strong> tag that will make the word bold.

bold.PNG So in the browser we'll have:

strong tag.PNG Or <em></em> tag that will make the word in italic.

italic.PNG In the browser we'll have:

em tag.PNG

div

<div></div> tag is used as a container for HTML elements.

div.PNG

Forms

The <form></form> tag is used to create a form.

The <form></form> tag can contain different kinds of inputs. These inputs are added in an <input/> tag.

form.PNG In the browser we have:

form tag.PNG

Tables

To create a table we use the <table></table> tag.

table.PNG <tr></tr> tags are added to create table rows.

<td></td> tags are added to create table cells

<th></th> tags are added to create table header.

In this example I added some CSS to see the table borders. So in the browser we have:

table tag.PNG

Audio

<audio></audio> tag allows us to add an audio to the website.

audio tag.PNG In the browser we have:

audio.PNG

Conclusion

As a web developer, you need to learn a lot of code. That starts with learning HTML first. As there are many tags, you might forget some of them, as there is a human tendency to forget some data. But if that happens, it is okay, as now you have a cheatSheet with the most used tags in HTML that you can use whenever you forget something.

Hope it helps.

Did you find this article valuable?

Support Purpose Code by becoming a sponsor. Any amount is appreciated!