NOTES
HTML Tags in Web Development:
Definition:
HTML (Hypertext Markup Language) tags are keywords or elements used to define the structure
and presentation of content on a web page.
Syntax:
Tags are enclosed within angle brackets, such as <tagname>.
Most HTML tags have both an opening tag and a closing tag, with content placed between them.
Example: <p>This is a paragraph.</p>
Browsers primarily understand HTML for structure, CSS for styling, and JavaScript for
interactivity.
These languages work together to create dynamic and visually appealing web pages.
1. <html> Tag:
The <html> tag is the root element of an HTML document.
It wraps the entire content of the HTML document.
All other HTML elements are nested inside the <html> tag.
It is paired with the </html> closing tag.
Example:
<!DOCTYPE html>
<html>
<!-- HTML content goes here -->
</html>
2. <head> Tag:
The <head> tag is a container for metadata about the HTML document.
It includes elements such as <title>, <meta>, <link>, <style>, <script>, and more.
It does not contain the visible content of the page.
It is paired with the </head> closing tag.
Example:
<head>
<!-- Metadata and other head elements go here -->
</head>
3. <title> Tag:
The <title> tag is used to define the title of an HTML document.
It is placed inside the <head> section.
The title appears on the browser's title bar or tab.
It helps in identifying the page when bookmarked.
Example:
<head>
<title>My Website</title>
</head>
4. <body> Tag:
The <body> tag contains the visible content of the HTML document.
It includes elements like text, images, links, forms, and more.
It is paired with the </body> closing tag.
Everything between <body> and </body> is rendered on the webpage.
Example:
<body>
<!-- Visible content goes here -->
</body>
5. <!DOCTYPE html> Declaration:
The <!DOCTYPE html> declaration is used to specify the version of HTML being used.
It helps browsers to render the web page correctly.
For modern HTML5 documents, <!DOCTYPE html> is used.
It is placed at the very beginning of the HTML document.
Example:
<!DOCTYPE html>
<html>
<!-- HTML content goes here -->
</html>
These elements form the basic structure of an HTML document. The combination of <html>,
<head>, <title>, <body>, and <!DOCTYPE html> provides a standardized and organized way to
structure and present content on the web.