HTML Basics
## Learning Objectives
- Master basic HTML elements
- Understand attributes
- Create headings, paragraphs, and text formatting
- Work with links and images
## Basic Text Elements
### Headings
HTML provides six heading levels from `` to `
```
### Image with Width and Height
```html
```
### Image from URL
```html
```
## Lists
### Unordered List
```html
```
### Common Attributes
- `id` - unique identifier
- `class` - CSS class name
- `style` - inline CSS
- `title` - tooltip text
- `data-*` - custom data attributes
## Block vs Inline Elements
### Block Elements
Start on a new line and take full width:
```html
` to ``:
```html
Main Heading (Page Title)
Section Heading
Subsection Heading
Sub-subsection Heading
Minor Heading
Smallest Heading
```
### Paragraphs
```html
Main Heading (Page Title)
Section Heading
Subsection Heading
Sub-subsection Heading
Minor Heading
Smallest Heading
``` ### Paragraphs ```htmlThis is a paragraph of text. Browsers automatically add space before and after paragraphs.
Another paragraph with bold and italic text.
``` ### Line Breaks ```htmlThis is line one
This is line two
Use bold for visual emphasis.
Use strong for semantic importance.
``` ### Italic and Emphasis ```htmlUse italic for visual style.
Use emphasis for semantic stress.
``` ### Underline ```htmlUse underline sparingly.
``` ### Strikethrough ```htmlOld price: $100 $75
The formula is H2O.
23 equals 8.
``` ## Links ### Basic Link ```html Visit Example ``` ### Link with Title ```html Example Site ``` ### Open in New Tab ```html New Tab ``` ### Internal Links ```html About Page Jump to Section ``` ## Images ### Basic Image ```html
```
### Image with Width and Height
```html
```
### Image from URL
```html
```
## Lists
### Unordered List
```html
- First item
- Second item
- Third item
- Step one
- Step two
- Step three
- HTML
- HyperText Markup Language - the standard markup language for web pages
- CSS
- Cascading Style Sheets - used for styling web pages
```
### Common Attributes
- `id` - unique identifier
- `class` - CSS class name
- `style` - inline CSS
- `title` - tooltip text
- `data-*` - custom data attributes
## Block vs Inline Elements
### Block Elements
Start on a new line and take full width:
```html
, -
,
-, , , - ,
,
```
### Inline Elements
Flow within text:
```html
, , , ,
,
```
## Special Characters
| Character | HTML Entity |
|-----------|-------------|
| < | `<` |
| > | `>` |
| & | `&` |
| " | `"` |
| ' | `'` |
| Space | ` ` |
## Comments
```html
```
## Summary
- Use `` to `` for headings
- Use `
` for paragraphs
- Use `` for links with `href` attribute
- Use `
` for images with `src` and `alt` attributes
- Use ``, ``, and `` for lists
- Block elements start on new lines; inline elements flow with text
- ,
- ,
, ``` ### Inline Elements Flow within text: ```html , , , , ,
``` ## Special Characters | Character | HTML Entity | |-----------|-------------| | < | `<` | | > | `>` | | & | `&` | | " | `"` | | ' | `'` | | Space | ` ` | ## Comments ```html ``` ## Summary - Use `` to `
` for headings - Use `
` for paragraphs - Use `` for links with `href` attribute - Use `
` for images with `src` and `alt` attributes - Use `
- `, `
- `, and `
- ` for lists
- Block elements start on new lines; inline elements flow with text
- ,
Comments
Comments powered by Giscus
To enable comments, add your Giscus embed code here.
Learn more about Giscus →