/    /  Building blocks of HTML

Building blocks of HTML

 

An HTML document consists of its basic building blocks which are:

 

Tags:

 

An HTML tag surrounds the content and applies meaning to it. It is written between < and > brackets.

 

Attribute:

 

An attribute in HTML allows extra information about the element, and it is applied within the start tag. An HTML attribute contains two fields: name and value.

 

Syntax:

 

<tag name  attribute_name= " attr_value"> content </ tag name>

 

Elements:

 

An HTML elements is an own component of an HTML file. the HTML file, everything written inside tags is termed as HTML elements.

 

Building blocks of HTML

 

Example:

 

<!DOCTYPE html> 
<html> 
 <head> 
  <title>The basic building blocks of HTML</title> 
</head> 
 <body> 
   <h2>The building blocks</h2> 
   <p>This is a paragraph tag</p> 
   <p style="color: red">The style is attribute of paragraph tag</p> 
   <span>The element contains tag, attribute and content</span> 
 </body> 
</html>

 

OUTPUT: