TAGS & ATTRIBUTES

HTML Tags :


HTML tags are like keywords which define thathow web browser will format and display the content.
HTML tags contain three main parts:
  • Opening tag
  • Content and
  • Closing tag
But some HTML tags are unclosed tags. All HTML tags must enclosed within < > these brackets. Every tag in HTML perform different tasks. If you have used an open tag < tag >, then you must use a close tag (except some tags)
Syntax :
  < tag > Content < /tag > 

Types of Tags :


There are two types of tags present in HTML. They are
  • Paired Tags
  • Unpaired Tags
1. Paired Tags (Container Tags) :
An HTML tag which consists of an opening tag and a closing tag is called as Paired Tags. The first tag can be referred to as the ‘Opening Tag’, and the second tag can be called Closing Tag. They are also called as Container Tags.

2. Unpaired Tags (Self-closing Tags / Empty Tags / Void Tags(Void Elements)) :
An HTML tag which only has an opening tag and does not have a closing tag is called as Unpaired Tag. The Unpaired HTML tag does not require a closing tag; an opening tag is sufficient in this type. They are also called as Self-Closing Tags, Empty Tags, Void Elements / Tags.


HTML Elements :


An HTML element is a collection of start tag, attributes, end tag, content between them. The element usually starts with an opening tag which consists the name of the element and it indicates where the element begins. The closing tag includes a forward slash before the element's name. Everything inside the opening and closing tags is the content.
html-1

Basic structure of an HTML Document :
You can see the basic structure of HTML in above heading(Example of Simple HTML document).

HTML Attributes :
Elements also have attributes, whichprovides additional information about elements thatwill not appear in the content. Attributes are always specified in the start tag.
Syntax :
  < element attribute_name="attribute_value" >

html-2

Characteristics of Attributes :
There is a space between attributes and the element name
  • Attributes are added in the opening tag.
  • Elements can have many attributes.
  • Attributes usually have a name and a value:name=“value”
  • Note : But not every attribute has the same pattern.Some can exist without values, and we call them Boolean Attributes.



    (WebTech - Basic Tags,Formatting Tags & Anchor Tag )