html_notes_and_examples
html_notes_and_examples
1. What is HTML?
HTML (HyperText Markup Language) is the standard language for creating web pages.
It uses "tags" to structure content like text, images, links, and more.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Smaller Subheading</h3>
2. Paragraphs:
3. Links:
4. Images:
5. Lists:
- Ordered List (numbered):
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
- Unordered List (bulleted):
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
4. Forms:
Forms allow users to input data.
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<div>
<h1>Title</h1>
<p>This is inside a div.</p>
</div>
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is my first web page using HTML.</p>
<h2>About Me</h2>
<p>I am learning HTML and this is a great start!</p>
<h2>My Hobbies</h2>
<ul>
<li>Reading</li>
<li>Coding</li>
<li>Gaming</li>
</ul>
<p>For more info, visit <a href="https://example.com">Example.com</a>.</p>
</body>
</html>
7. Practice Exercises:
1. Create a webpage with a heading and two paragraphs.
2. Add a link to your favorite website.
3. Create an image gallery using multiple <img> tags.
4. Make a form that asks for a name and email.
8. HTML Tables:
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
<th>Country</th>
</tr>
<tr>
<td>John</td>
<td>25</td>
<td>USA</td>
</tr>
<tr>
<td>Maria</td>
<td>30</td>
<td>Spain</td>
</tr>
</table>
Semantic HTML elements provide meaning to the structure of your web page, improving
accessibility and SEO.
- Header:
<header>
<h1>Welcome to My Website</h1>
<nav>
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#contact">Contact</a>
</nav>
</header>
- Article:
<article>
<h2>Article Title</h2>
<p>This is an article about HTML semantics.</p>
</article>
- Section:
<section>
<h2>Section Title</h2>
<p>This is a section of the page.</p>
</section>
- Footer:
<footer>
<p>Copyright © 2024. All rights reserved.</p>
</footer>
You can embed multimedia like audio and video directly into HTML.
- Audio:
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
- Video:
<!DOCTYPE html>
<html>
<head>
<title>John Doe's Profile</title>
</head>
<body>
<header>
<h1>John Doe</h1>
<nav>
<a href="#about">About</a> |
<a href="#skills">Skills</a> |
<a href="#contact">Contact</a>
</nav>
</header>
<section id="about">
<h2>About Me</h2>
<p>Hi! I am John, a web developer with a passion for building great
websites.</p>
</section>
<section id="skills">
<h2>My Skills</h2>
<ul>
<li>HTML & CSS</li>
<li>JavaScript</li>
<li>Web Design</li>
</ul>
</section>
<section id="contact">
<h2>Contact Me</h2>
<form action="/submit-profile" method="post">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<input type="submit" value="Send">
</form>
</section>
<footer>
<p>Follow me on <a href="https://twitter.com/johndoe">Twitter</a>.</p>
</footer>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>My Blog</title>
</head>
<body>
<header>
<h1>Welcome to My Blog</h1>
</header>
<article>
<h2>First Blog Post</h2>
<p>This is my first blog post. I love writing about technology and coding!</p>
</article>
<article>
<h2>Second Blog Post</h2>
<p>Today, I'll be sharing some tips on how to learn HTML faster.</p>
</article>
<footer>
<p>© 2024 My Blog. All rights reserved.</p>
</footer>
</body>
</html>