Introduction to HTML Tags
HTML Basic Tags
Before learning the HTML elements, you should know the tags. An HTML tag is some markup inside two angle brackets (‘<’) and (‘>’). For example ‘<b>’, ‘<html>’, ‘<head>’ etc. (without quotes) Types of HTML Tag:
Start Tag:- Start tag starts an HTML element. It marks the beginning of and HTML element. All the previous examples are examples of start tags.
End Tag:- End Tag marks the ending of an HTML element. This is similar to a start tag except that it has a ‘/’ (slash) after the opening angle bracket. Hence the example of and HTML tag would be </title></head> etc. For a semantically valid HTML code apart from other things the number of start and end tags should be equal.
HTML Tag Identification:- An Exercise
Now armed with the above knowledge, see if you can identify all the HTML tags in the previous example again discussed below. Can you categorize them in Start and End tags. After you complete this small exercise, match your results with the answer given below the question. Referring the example on previous page.
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>This is the output of my first HTML page!</h1>
</body>
</html>
HTML Tag Identification:- Answer
There are five pairs of HTML tags.
The start tags are <html><head><title><body> and <h1>.
Their respective end tags are </html></head></title></body> and </h1>.
If you observe the pattern of appearance of these tags you will find that their nesting is unique. The last start tag is the first one to get its end tag. Always keep this rule in mind while writing a good HTML code.
- 899 reads
