What is HTML?
HTML stands for HyperText Markup Language. It is the standard markup language used to create web pages. Think of HTML as the “skeleton” or “structure” of your website. It tells the web browser how to organize content—where the headings go, where the paragraphs are, and where images should be displayed.
- HyperText: Links that connect web pages to one another.
- Markup: The code (tags) that surrounds content to define its structure.
The Basic Structure
Every HTML document follows a specific structure. This is often called the “boilerplate.” Here is what the bare minimum looks like:
Page Title
This is a Heading
This is a paragraph.
Breakdown of the Code:
-
<!DOCTYPE html>: Tells the browser that this is an HTML5 document. -
<html>: The root element that contains all the code. -
<head>: Contains "meta" information about the page (like the title shown in the browser tab) that isn't visible on the main page. -
<body>: Contains the visible page content (text, images, links).
Understanding Tags and Elements
HTML uses tags to define elements. Tags usually come in pairs: an opening tag and a closing tag.
-
Opening Tag:
<p>(Starts the element) -
Content:
Hello World(The info inside) -
Closing Tag:
</p>(Ends the element)
Note: Some tags are “self-closing” or “empty,” meaning they don’t need a closing tag (e.g., <br> for a line break or <img> for images).
Essential HTML Tags
Headings
Headings define the structure and hierarchy of your content. <h1> is the most important, and <h6> is the least.
Main Title (H1)
Subheading (H2)
Section Title (H3)
Paragraphs
The <p> tag defines a block of text.
This is a paragraph of text explaining a topic.
<a> tag creates a hyperlink. The href attribute specifies the destination URL. Lists
-
Unordered List
<ul>: Creates a bulleted list. -
Ordered List
<ol>: Creates a numbered list. -
List Item
<li>: The actual item inside the list.
- Coffee
- Tea
- Milk
HTML Attributes
Attributes provide additional information about HTML elements. They are always specified in the opening tag and usually come in name/value pairs like name="value".
| Attribute | Description | Example |
|---|---|---|
href | Specifies the URL for a link | <a href="page.html"> |
src | Specifies the path to an image | <img src="pic.jpg"> |
width | Specifies the width of an image | <img width="500"> |
alt | Specifies alt text for an image | <img alt="A dog"> |
style | Adds inline CSS styles (color, font, etc.) | <p style="color:red;"> |
Summary: Your First Web Page
My First Page
Welcome to My Website
This is a paragraph about the website. We teach coding here!
My Hobbies
- Coding
- Reading
- Gaming
Contact Us
