What is an HTML tag What is an HTML tag

After having talked about concepts related with HTML so far, let's start with the core concept behind HTML - a Tag. Tags are the building blocks in HTML. To be able to write HTML code you need to know about the tags which you should be using. But before you learn about the actual HTML tags, you should first understand about a tag itself. Tags are not just used in HTML; they are used in many different programming languages. Once you understand the meaning of a tag and learn how to write it you will be able to use the same concept in all other programming languages which are written using tags.

What is a mark-up language?

Any language which is written using tags is called a mark-up language. Common examples of mark-up languages are XML, HTML, XHTML etc. You will find different tags in different markup languages, but the way in which these tags are written will be the same. Before learning the tags given to you by different markup languages it is important to learn how to write a tag itself.

What is a Tag?

To understand about a tag let’s start by taking an example.

Whenever you write some information, you always want to present it in a meaningful way. Suppose I write the following information

Ravinder Singh

Sammy Dev

Gurvinder Singh

What do you understand from this information written above? Not much, right ? All you can understand is that these are names of three people. But who these people are, what their relation is with each other or with me is not clear from this information. If you are not an Indian, you might be able to guess that the above three items are names of people. But no matter whoever you are, you will never be able to tell the real meaning or purpose of the above information.

Now let’s try to make the above information more meaningful by adding some more meaning to it.

Company head : Ravinder Singh

Business partner : Sammy Dev

Good friend : Gurvinder Singh

Now when you read this information are you able to understand it better? Yes of course. What have we done to make this information more meaningful ? We have just done one simple thing - we have tagged it. We have tagged Ravinder Singh as company head, Sammy Dev as business partner and Gurvinder Singh as a good friend.

But there is one more problem with this information - it is only meaningful for a human being and not for a computer. As computers cannot understand English language, we will have to present this information to the computer in a different format. So let’s use tags to represent the above information.

<CompanyHead> Ravinder Singh </CompanyHead>  

<BusinessPartner> Sammy Dev </BusinessPartner> 

<GoodFriend> Gurvinder Singh </GoodFriend>

We have now written the same information using tags. As you can see the manner in which we have represented the information using tags in not very complex. Let's try to understand about the tags we have used above.

<CompanyHead>, <BusinessPartner> and <GoodFriend> are tags. A tag is used to add meaning to the information so that a computer can understand that information. A few important things which you should know about any tag are

  1. Every tag has a starting and an ending
  2. A tag starts with <tagname> and ends with </tagname>. See the way we have closed the tag using </
  3. Never put a space in the tag name. We have written <CompanyHead> and NOT <Company  Head> with space between company and head.
  4. The words in the starting and the ending tags should match exactly.

Can I use any tag I want?

The answer to this question is both yes and no.

There are two sides of the game - language and its parser. By parser we mean a software that will read the language and understand it by applying proper rules to it. You can think of yourself as an English language parser because you can read and understand English language.

If a mark-up language comes with its own parser or in other words if there is a software available to read and understand a mark-up language, then you cannot use your own tags. If on the other hand a mark-up language does not come with a parser, then you are allowed to use your own tags. But then it will mean that you will have to write your own parser to understand your tags.

HTML is a language which comes with its own parser which we call as a browser. So you cannot use your own tags when writing HTML

XML on the other hand does not come with a standard parser and therefore you can use any tags you want and then you will have to write a parser to understand your tags and extract meaning out of it.

"OK, got it. So you are saying that HTML is a mark-up language so it is written using tags. And because a browser reads and understands HTML language we call it the parser for the HTML language. Because the HTML language has its own parser we cannot use our own tags when writing HTML. Even if we write our own tags the browser will not be able to understand them”?

Yes, exactly!!

Now that you have understood the meaning of a tag and how tags are written you are ready to learn about all tags which are given to you by HTML. But before we finally start teaching you HTML tags we will first teach you about attributes and the role they play when writing tags.

Need Learning Guidence?
Join our Study Groups and get step by step guidence.
Learn HTML and CSS
The goal of creating this study group is to help students who are beginners to HTML and CSS program
7
Members
1
Questions Asked
0
Tasks Added
Learn Website Development
This goal of this study group is to help students learn the basics of website development using HTM
1
Members
0
Questions Asked
0
Tasks Added
Website Development Interview Preparation
This goal of this study group is to help students prepare for their website development interviews.
1
Members
0
Questions Asked
0
Tasks Added
Web Wars 1.0 - Build Your Digital CV
The goal of this study group is to manage all the communication for the 'Web Wars 1.0 - Build Your
110
Members
0
Questions Asked
0
Tasks Added

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp