HTML Basics

HTML Basics

Before building real pages, you need to understand the basic building blocks: the document type, tags, attributes, and overall structure. This page covers them all.


The Basic Structure

Every HTML document follows the same skeleton. The DOCTYPE declaration comes first, then the html element wraps a head and a body.

The standard HTML5 skeleton
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Page Title</title>
</head>
<body>
  <!-- Visible content goes here -->
</body>
</html>

Tags and Attributes

A tag is a keyword wrapped in angle brackets. An attribute is extra information placed inside the opening tag as a name and value pair. In the example below, href is an attribute of the anchor tag.

A tag with an attribute
<a href="https://example.com">Visit Example</a>
  • <a> is the opening tag.
  • href="https://example.com" is the attribute (name = value).
  • Visit Example is the content the user clicks.
  • </a> is the closing tag.
⚠️

Attribute values should always be wrapped in quotes. Forgetting quotes can break your page in confusing ways, especially when a value contains spaces.

💡

HTML ignores extra spaces and line breaks in your code. Use indentation freely to keep your files readable; the browser will not care.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships