About Lesson
Here are some basic HTML examples to help you understand the syntax and usage of common HTML elements:
- Headings and Paragraphs:
<!DOCTYPE html>
<html>
<head>
<title>HTML Basics</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
- Links:
<!DOCTYPE html>
<html>
<head>
<title>HTML Basics</title>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>Check out the <a href="https://www.example.com">Example Website</a>.</p>
</body>
</html>
- Images:
<!DOCTYPE html>
<html>
<head>
<title>HTML Basics</title>
</head>
<body>
<h1>Amazing Nature Photos</h1>
<img src="image.jpg" alt="Nature Image">
</body>
</html>
Replace "image.jpg"
with the actual path or URL of your image file.
- Lists:
<!DOCTYPE html>
<html>
<head>
<title>HTML Basics</title>
</head>
<body>
<h1>My Shopping List</h1>
<ul>
<li>Apples</li>
<li>Bananas</li>
<li>Oranges</li>
</ul>
</body>
</html>
- Tables:
<!DOCTYPE html>
<html>
<head>
<title>HTML Basics</title>
</head>
<body>
<h1>Employee List</h1>
<table>
<tr>
<th>Name</th>
<th>Position</th>
<th>Salary</th>
</tr>
<tr>
<td>John Doe</td>
<td>Manager</td>
<td>$5000</td>
</tr>
<tr>
<td>Jane Smith</td>
<td>Developer</td>
<td>$4000</td>
</tr>
</table>
</body>
</html>
- Forms:
<!DOCTYPE html>
<html>
<head>
<title>HTML Basics</title>
</head>
<body>
<h1>Contact Form</h1>
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email"><br><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message"></textarea><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
These examples demonstrate the usage of some common HTML elements like headings, paragraphs, links, images, lists, tables, and forms. You can further explore and experiment with different HTML elements and their attributes to build more complex web pages.
Join the conversation