HTML Lang Notes
HTML Lang Notes
HTML (HyperText Markup Language) is the standard language for creating web pages.
Here's a simple explanation of how it works:
```html
<!DOCTYPE html>
<html>
<head>
<title>My First Web Page</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is my first paragraph.</p>
</body>
</html>
```
Key Components:
1. `<!DOCTYPE html>` - Declares this is an HTML5 document
2. `<html>` - Root element of the page
3. `<head>` - Contains meta information about the page
4. `<title>` - Sets the title shown in browser tabs
5. `<body>` - Contains the visible page content
Text Formatting
- `<h1>` to `<h6>` - Headings (h1 is largest)
- `<p>` - Paragraph
- `<strong>` or `<b>` - Bold text
- `<em>` or `<i>` - Italic text
- `<br>` - Line break (self-closing)
Lists
```html
<ul> <!-- Unordered list (bullets) -->
<li>Item 1</li>
<li>Item 2</li>
</ul>
Tables
```html
<table>
<tr> <!-- Table row -->
<th>Header 1</th> <!-- Table header -->
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td> <!-- Table data -->
<td>Data 2</td>
</tr>
</table>
```
Forms
```html
<form action="/submit" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
```html
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<style>
body { font-family: Arial, sans-serif; }
header { background-color: f0f0f0; padding: 20px; }
</style>
</head>
<body>
<header>
<h1>Welcome to My Site</h1>
<nav>
<a href="home">Home</a> |
<a href="about">About</a> |
<a href="contact">Contact</a>
</nav>
</header>
<main>
<article>
<h2>About Me</h2>
<p>I'm learning HTML to build websites!</p>
</article>
</main>
<footer>
<p>© 2023 My Website</p>
</footer>
</body>
</html>
```