The Building Blocks of HTML
HTML Tags and Elements
HTML uses tags to define elements on a webpage. Tags usually come in pairs: an opening tag and a closing tag.
<p>This is a paragraph.</p>
Here, <p>
is the opening tag, This is a paragraph.
is the content, and </p>
is the closing tag.
HTML Attributes
Attributes provide extra information about an element.
For example, the <a>
(anchor) tag uses the href
attribute to specify the linkβs destination:
<a href="https://www.google.com">Visit Google</a>
This creates a clickable link that takes you to Google.
Basic HTML Document Structure
Every HTML document starts with a standard boilerplate structure:
<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
This defines a simple webpage that displays "Hello World" as a heading.