FUNDEMENTAL NOTES ON HTML
FUNDEMENTAL NOTES ON HTML
Here are some foundational notes on HTML to help you get started:
- **HTML (Hypertext Markup Language)** is the standard language used to create and structure
web pages.
- It consists of a series of elements that are used to define different parts of a webpage, like
headings, paragraphs, images, links, lists, etc.
```html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Heading</h1>
</body>
</html>
```
- **`<!DOCTYPE html>`**: Declares the document type and version of HTML (HTML5 here).
- **`<head>`**: Contains meta-information like title, character set, and links to stylesheets.
- **`<body>`**: Holds all visible content, such as headings, paragraphs, images, etc.
- **Tags**: HTML elements are represented by tags. Most tags have an opening (`<tag>`) and
closing tag (`</tag>`), with the content in between.
```html
<p>This is a paragraph.</p>
```
- **Self-Closing Tags**: Some tags don’t require a closing tag, such as `<img />` and `<br />`.
- **Headings**: `<h1>` to `<h6>`, with `<h1>` being the most important and `<h6>` the least.
```html
<h1>Main Heading</h1>
<h2>Subheading</h2>
```
- **Images**: `<img src="URL" alt="Description">` to add images. `alt` provides a description for
accessibility.
- **Lists**:
```html
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
```
- Attributes provide additional information about elements and are placed inside the opening tag.
- Common attributes:
- **`id`**: Unique identifier for an element.
```html
```
- Semantic HTML tags describe the purpose of the content, helping browsers and screen readers
understand it better.
- **Form Elements**:
- `<input>`: Allows for various types of data input (text, password, email, checkbox).
```html
<label for="name">Name:</label>
<input type="text" id="name" name="name" />
<button type="submit">Submit</button>
</form>
```
- HTML entities are used to represent reserved characters in HTML, such as:
### 9. **Comments**
- Comments are used to leave notes within the code that won’t be rendered in the browser.
```html
```
- **Use Semantic Tags**: Makes your HTML more meaningful and improves accessibility.
- **Keep it Structured**: Nest elements properly and avoid deeply nested structures when
possible.
- **Use Alt Attributes for Images**: Essential for accessibility and SEO.
- **Validate Your HTML**: Use a validator to ensure your HTML is error-free and follows the HTML5
standard.
- **Accessibility Considerations**: Use attributes like `aria-label` and semantic tags to help assistive
technologies interpret your page.
These notes cover the fundamentals of HTML and set a strong foundation to start building web
pages.