HTML tutorials for Beginners
Concept 1: Document Structure
Every HTML document starts with a declaration and a set of elements nested within the `<html>` tag. The basic structure includes the `<head>` and `<body>` sections.
<!DOCTYPE html>
<html>
<head>
<title>Document Title</title>
</head>
<body>
<!-- Content goes here -->
</body>
</html>
Concept 2: Headings and Paragraphs
HTML offers six levels of headings (`<h1>` to `<h6>`) to structure your content, and paragraphs are created using the `<p>` tag.
<h1>Main Heading</h1>
<p>This is a paragraph of text.</p>
Concept 3: Links
Links are created using the `<a>` (anchor) tag. The `href` attribute specifies the URL.
<a href="https://www.example.com">Visit Example</a>
Concept 4: Images
Images are added using the `<img>` tag. The `src` attribute contains the image URL.
<img src="image.jpg" alt="Description of the image">
Concept 5: Lists
Unordered and ordered lists are created with the `<ul>` and `<ol>` tags, respectively. List items are represented by `<li>` tags.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
Concept 6: Forms and Input
Forms are built using the `<form>` tag. Input elements like text fields, checkboxes, and radio buttons use the `<input>` tag.
<form action="/submit" method="post">
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<input type="submit" value="Submit">
</form>
Concept 7: Buttons
Buttons can be created using the `<button>` tag.
<button>Click Me</button>
Concept 8: Comments
Comments help developers add notes to their code. They don't appear in the rendered output.
<!-- This is a comment -->
Concept 9: Semantic Elements
Semantic elements like `<header>`, `<nav>`, `<main>`, `<article>`, `<section>`, and `<footer>` provide meaning to the structure of a web page.
<header>
<h1>Website Header</h1>
</header>
<main>
<article>
<h2>Article Title</h2>
<p>Article content...</p>
</article>
</main>
<footer>
<p>Contact us at info@example.com</p>
</footer>
Concept 10: Divisions
The `<div>` tag is a generic container used for styling and layout purposes.
<div class="container">
<p>This is inside a div.</p>
</div>
Concept 11: Formatting Text
Tags like `<strong>`, `<em>`, `<u>`, and `<s>` are used for bold, italic, underline, and strikethrough text, respectively.
<p>This is <strong>bold</strong> and <em>italic</em> text.</p>
Concept 12: Comments
Comments help developers add notes to their code. They don't appear in the rendered output.
<!-- This is a comment -->
Concept 13: Links and Anchors
The `<a>` tag creates hyperlinks, allowing you to link to external websites, pages within your site, or even specific sections within a page.
<a href="https://www.example.com">Visit Example</a>
<a href="#section">Jump to Section</a>
Concept 14: Images
The `<img>` tag is used to embed images in your HTML documents.
<img src="image.jpg" alt="Description of the image">
Concept 15: Lists
Use the `<ul>` and `<ol>` tags for creating unordered and ordered lists, respectively.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
Concept 16: Forms and Input
Forms are created using the `<form>` tag, and various input elements collect user data.
<form action="/submit" method="post">
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<input type="submit" value="Submit">
</form>
Concept 17: Buttons
Buttons are made using the `<button>` tag.
<button>Click Me</button>
Concept 18: Comments
Use `<!-- ... -->` to add comments in your HTML code for explanations.
<!-- This is a comment -->
Concept 19: Semantic Elements
Semantic elements like `<header>`, `<nav>`, `<main>`, `<article>`, and `<footer>` add meaning to page structure.
<header>
<h1>Website Header</h1>
</header>
<main>
<article>
<h2>Article Title</h2>
<p>Article content...</p>
</article>
</main>
<footer>
<p>Contact us at info@example.com</p>
</footer>
Concept 20: Divisions
The `<div>` tag acts as a generic container for layout and styling purposes.
<div class="container">
<p>This is inside a div.</p>
</div>
Concept 21: Formatting Text
Use tags like `<strong>`, `<em>`, `<u>`, and `<s>` for bold, italic, underline, and strikethrough text.
<p>This is <strong>bold</strong> and <em>italic</em> text.</p>
Concept 22: Special Characters
Some characters have special meanings in HTML and need to be escaped using character entities.
<p>© 2023 Example Company</p>
Concept 23: Tables
Tables are created using the `<table>`, `<tr>`, and `<td>` tags.
<table>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2
</td>
</tr>
</table>
Concept 24: Audio and Video
The `<audio>` and `<video>` tags allow you to embed multimedia content.
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<video controls>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video element.
</video>
Concept 25: Comments
Comments are notes for developers and are not displayed in the rendered page.
<!-- This is a comment -->
Concept 26: Forms and Input
Forms collect user input and use various input types like text, radio, and checkboxes.
<form action="/submit" method="post">
<input type="text" name="username" placeholder="Username">
<input type="password" name="password" placeholder="Password">
<input type="submit" value="Submit">
</form>
Concept 27: Lists
Use the `<ul>` and `<ol>` tags to create unordered and ordered lists.
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
Concept 28: Buttons
Buttons can be created using the `<button>` tag.
<button>Click Me</button>
Concept 29: Semantic Elements
Use semantic elements like `<header>`, `<nav>`, `<main>`, `<article>`, and `<footer>` to structure your page.
<header>
<h1>Website Header</h1>
</header>
<main>
<article>
<h2>Article Title</h2>
<p>Article content...</p>
</article>
</main>
<footer>
<p>Contact us at info@example.com</p>
</footer>
Concept 30: Divisions
The `<div>` tag is a versatile container used for styling and layout.
<div class="container">
<p>This is inside a div.</p>
</div>