HTML Code

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

It seems you'd like to see some HTML code examples.

Here are 40 HTML code snippets covering various


aspects of web development, including basic structure, text formatting, links, images, lists, tables, and
forms. These examples should help you get started with HTML:

1. **Basic HTML Structure**:

```html

<!DOCTYPE html>

<html>

<head>

<title>My Web Page</title>

</head>

<body>

<h1>Hello, World!</h1>

<p>This is a simple HTML page.</p>

</body>

</html>

```

2. **Headings**:

```html

<h1>Heading 1</h1>

<h2>Heading 2</h2>

<h3>Heading 3</h3>

<h4>Heading 4</h4>

<h5>Heading 5</h5>

<h6>Heading 6</h6>
```

3. **Paragraphs**:

```html

<p>This is a paragraph.</p>

```

4. **Links**:

```html

<a href="https://www.example.com">Visit Example</a>

```

5. **Images**:

```html

<img src="image.jpg" alt="Image Description">

```

6. **Lists**:

```html

<ul>

<li>Unordered List Item 1</li>

<li>Unordered List Item 2</li>

<li>Unordered List Item 3</li>

</ul>
<ol>

<li>Ordered List Item 1</li>

<li>Ordered List Item 2</li>

<li>Ordered List Item 3</li>

</ol>

```

7. **Tables**:

```html

<table>

<tr>

<th>Header 1</th>

<th>Header 2</th>

</tr>

<tr>

<td>Row 1, Cell 1</td>

<td>Row 1, Cell 2</td>

</tr>

<tr>

<td>Row 2, Cell 1</td>

<td>Row 2, Cell 2</td>

</tr>

</table>

```
8. **Forms**:

```html

<form action="submit.php" method="post">

<label for="name">Name:</label>

<input type="text" id="name" name="name"><br>

<label for="email">Email:</label>

<input type="email" id="email" name="email"><br>

<input type="submit" value="Submit">

</form>

```

9. **Divs** (for grouping and styling):

```html

<div id="header">This is the header</div>

<div class="content">This is the content</div>

```

10. **Comments** (for adding notes to your code):

```html

<!-- This is a comment -->

```
These HTML code snippets cover some of the most basic elements of web development. You can use
and combine these elements to create web pages with various structures and styles. Remember to
customize the attributes and content according to your specific needs.

You might also like