Write a short note on Tags and Attributes in HTML.

The World Wide Web Consortium has given a set of standards while building the HTML language. The W3C uses some special words to define an action.

Tag

A tag is a special word enclosed in angle-brackets < >. A tag tells the browser to perform an action as asked by the special word. The special word may be written either in lower case or upper case. The browser will respond to both the cases equally.

The HTML tags are normally comes in pair of start and end tag(an opening tag and closing tag). While the start tag is written in the beginning of the element as <SpecialWord>, the end tag is written at the completion of the element as </SpecialWord>.

For example: When you want to begin with writing source code using HTML, you write the start tag as <HTML> and when you have completely written in the HTML document and want to end it, you write the end tag as </HTML> i.e. insert a forward slash followed by HTML in angled brackets.

Attribute

The characteristics or the features of a tag are defined by an attribute. An attribute is used inside a tag. An attribute always takes a value to help the browser perform the specific task in a particular direction. There may be more than one attribute used inside a tag.

An element is a combination of a start tag, the text(we also use text to insert graphics) and the end tag.

For example:

<body> element begins with start tag, followed by text and ends with end tag.</body>

In simple words, one can equate an element to a block, a tag to an instruction and an attribute to an extension to a instruction.

Container of Tags: One set of tags may contain another set of tags. This is called nesting of tags. The second block of tags is always contained in first block as shown below:

<TAG1> <TAG2>……………</TAG2> </TAG1>
<TAG1> and </TAG1> is the first block of tags. <TAG2> and </TAG2> is the second

block of tags.

Leave a Comment

Your email address will not be published. Required fields are marked *