Building blocks of HTML
An HTML document consist of its basic building blocks which are:
- Tags: An HTML tag surrounds the content and apply meaning to it. It is written between < and > brackets.
- Attribute: An attribute in HTML provides extra information about the element, and it is applied within the start tag. An HTML attribute contains two fields: name and value.
Syntax
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>
The building blocks
This is a paragraph tag
The style is attribute of paragraph tag
The element contains tag, attribute and content<!DOCTYPE html>
The Purpose of <!DOCTYPE html>
🔹The very first line in every web document should contain a <!DOCTYPE html> declaration. Even though it's wrapped in angle brackets, it is not a tag but a statement.
🔹Doctype stands for Document Type Declaration. It informs the web browser about the type and version of HTML used in building the web document. This helps the browser to handle and load it properly.
The HTML5 word <!DOCTYPE html> means "this page is written in HTML5" as opposed to, say HTML 4.01.
Unlike earlier versions of HTML, in HTML5 the doctype declaration is case-insensitive.
In other words <!doctype html> works as well as <!DOCTYPE html>.
Hope you understand <!DOCTYPE html>😊!