A Simple HTML Document – Learn with HQLEduTech
HTML Example:
<!DOCTYPE html>
<html>
<head> <title>HTML Tutorial</title> </head>
<body> <h1>This is a heading</h1>
<p>This is a paragraph.</p> </body> </html>
Try it Yourself
<head> <title>HTML Tutorial</title> </head>
<body> <h1>This is a heading</h1>
<p>This is a paragraph.</p> </body> </html>
Explanation
<!DOCTYPE html>
– Declares the document type and version (HTML5)<html>
– Root element that wraps the entire page<head>
– Contains meta info like the page title<title>
– Sets the title seen on the browser tab<body>
– Contains all the content that appears on the page<h1>
– Main heading<p>
– A paragraph of text
What is an HTML Element?
An HTML element is the building block of every webpage. It consists of a start tag, some content, and an end tag.
Basic Syntax:
HTML
<tagname> Content goes here... </tagname>
The HTML element includes everything from the start tag to the end tag.
Examples:
HTML
<h1>My First Heading</h1>
<p>My first paragraph.</p>
Start Tag | Element Content | End Tag |
---|---|---|
<h1> | My First Heading | </h1> |
<p> | My first paragraph. | </p> |
<br> | (no content) | (none) |
Note: Some HTML elements like <br>
are self-closing and don’t have content or an end tag.