SHARE

Step by step learn how a HTML tags works

HTML tag is style of markup the text . HTML is short form of hyper text markup language .In HTML , markup means “mark any text to make it readable and structured format for web browsers” .Html is marked up with tags such as <html> ,<body>, <title> ,<p> etc .

To understand it how a HTML tag works, you need to learn more deep in HTML . When you write a tag in HTML , it not means you create a new element , but it means you markup a already existed element .

Suppose you write a Title tag in html ,it not means you create a title for your web page ,but it only means you only markup the specific text as title of the web page . A tag is created with “>” a greater than sign , a less than sign “<“ and a keyword “title” and at the end tag “/” before the keyword .

Example

<title>This is the title of the web page </title>

IN this example when less than sign “<“start , it tells the web browser to process this element and identify it. Now at next what is the identity of this element . “title ” keyword is the identity of this element .  Tag tells the web browser to process this element as “title” of the web page .

It is obvious that you think what is the need of “>” sign after title tag . So the answer is , this sign tell the web browser that this is the end of the specific keyword .

To understand this see the following example . In first “<h1>” tag > sign is used properly, in second <h1  tag > sign is forget and in third <h1 this> tag  greater than “>” is used on wrong place .

Example

<!doctype html>
<html lang=”en”>
<title>this is the title</title>
<body>

<h1>This is heading</h1>
<h1 this is heading</h1>
<h1 this> is heading</h1>

<body>
</html>

Result

how tag works in html
how tag works in html

When this HTML code is run on web browser and browser render first <h1> tag , it understand what keyword is started from “h” and end at “1”

In second h1 tag > sign is forgotten ,so browser understand that keyword is start from “h” ,but it not understand where the keyword ends. so this code is not rendered as heading of webpage .

In the third <h1> greated than > sign is after “this” word and so when the browser try to read this tag , it is read as <h1 this> tag . Which is not the write in HTML .

After end is closing tag </h> . This tag is render as same by the web browser ,but the only difference is when the “/” sign comes ,browser understand than the tag <h> ends here .

So i hope you will understand the working of the tag in html .