DEV Community

HARSH VATS
HARSH VATS

Posted on • Updated on

HTML tags | HTML tutorial

We saw in the previous article about html basics. Now we will see some very common tags used inside body tag. Html tags are used like this <tag></tag> or <tag /> (called self-closing tag). Self closing tags does not require text inside them like <img />, <input />. However other tags require like click me </btn>.

<h1>

You can have 6 different sizes of headings ranging from h1(largest) to h6(smallest).

<div>

This tag is the mostly used tag. As the name suggest, it is the division in html document. By default it starts from left side and cover the whole page but you can set it's size as you wish.

<p>

This is paragraph tag used for writing paragraphs. However you can use div instead of p tag without any problem.

<span>

This tag is used to specify a specific (generally small like a word) portion of the text.

<br/>

This breaks a line for you. In html you cannot move to the next line just by pressing enter. This tag does the work for you.

<hr/>

This tag creates a horizontal line for you.

<button>

This tag is used to create buttons.

There are many more tags like these but I cannot cover all of them here. I will discuss each of them slowly. In next article we will learn about how to style your html page which will take your excitement level to some more heights. :)

Oldest comments (4)

Collapse
 
mitya profile image
Dima

Can i use hr tag? Maybe, best way to create line is css?

Collapse
 
mrtoxas profile image
mrtoxas • Edited

Depends on the destination. If just for beauty, then use styles. If you need semantics and thematic break, then use <hr>

Collapse
 
mostafa85876 profile image
Mostafa85876

You can create a line with CSS by specifying a border-bottom for a section in the document, like this:
div{
border-bottom: 5px solid green;
}

Collapse
 
mrtoxas profile image
mrtoxas • Edited
  1. Tag <btn> doesn't exist. Button tag is <button></button>
  2. Tags <br>, <hr>, <img>, <input> don't need a backslash.