1. List Tags in HTML
provides three types of lists:
✅ Unordered List (<ul>)
- Items are displayed with bullets().
- Types: disc (default), circle, square, none.
<ul style="list-style-type: square;">
<li>Item 1</li>
<li>Item 2</li>
</ul>
✅ **Ordered List (`<ol>`)**
- Items are displayed in **numbers or letters**.
- Types: `1`, `A`, `a`, `I`, `i`.
<ol type="I">
<li>Item 1</li>
<li>Item 2</li>
</ol>
✅ **Description List (`<dl>`)**
- Used for **terms and their descriptions**.
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
</dl>
✅ **Nested List**
Lists inside another list.
<ul>
<li>Tea
<ul>
<li>Black Tea</li>
<li>Green Tea</li>
</ul>
</li>
</ul>
🎨 **2. Colors in HTML**
HTML provides different ways to define **colors**:
✅ **Named Colors**
<p style="color: red;">This is Red</p>
✅ **Hex Colors (`#RRGGBB`)**
<p style="color: #ff0000;">This is Red</p>
✅ **RGB Colors (`rgb(r, g, b)`)**
<p style="color: rgb(255, 0, 0);">This is Red</p>
✅ **RGBA Colors (`rgba(r, g, b, alpha)`)**
<p style="color: rgba(255, 0, 0, 0.5);">This is Semi-Transparent Red</p>
**HSL Colors (`hsl(hue, saturation, lightness)`)**
<p style="color: hsl(0, 100%, 50%);">This is Red</p>
✅ **HSLA Colors (`hsla(h, s, l, a)`)**
<p style="color: hsla(0, 100%, 50%, 0.5);">This is Semi-Transparent Red</p>
🔗 **3. Anchor (`<a>`) Tag in HTML**
✅ **Basic Link**
<a href="https://www.google.com">Visit Google</a>
✅ **Open Link in a New Tab (`target="_blank"`)**
<a href="https://www.google.com" target="_blank">Open Google in New Tab</a>
✅ **Internal Link (Same Website Page)**
<a href="about.html">Go to About Page</a>
✅ **Email Link (`mailto:`)**
<a href="mailto:example@gmail.com">Send Email</a>
✅ **Call Phone Number (`tel:`)**
<a href="tel:+1234567890">Call Us</a>
✅ **Download File (`download`)**
<a href="file.pdf" download>Download File</a>
### 🏹 **4. `target` Attribute in `<a>` Tag**
target Value |
Description |
---|---|
_self |
Opens in same tab (default). |
_blank |
Opens in new tab. |
_parent |
Opens in parent frame (if inside an iframe). |
_top |
Opens in full browser window, removing frames. |
framename |
Opens inside a specific iframe. |
### ✅ **Example: Open Link in a New Tab**
<a href="https://www.google.com" target="_blank">Open in New Tab</a>
### 🎵 **5. Audio & Video in HTML**
### ✅ **Audio Tag**
<audio controls>
<source src="audio-file.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
✅ **Video Tag**
<video width="560" height="315" controls>
<source src="video-file.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
### **HTML Images**
The <img> tag is used to display images.
### ****✅ **Basic Image**
<img src="image.jpg" alt="A beautiful scenery">
🔹 **`src`** → Specifies the image file location.
🔹 **`alt`** → Alternative text (shown if the image fails to load).
### ✅ **Displaying an Online Image:**
<img src="https://example.com/image.jpg" alt="Example Image">
### ✅ **Image with Width & Height**
<img src="image.jpg" width="300" height="200" alt="Image">
### ✅ **Image with Title (Hover Text)**
<img src="image.jpg" title="This is an image" alt="Image">
### ✅ **Responsive Image (`max-width`)**
<img src="image.jpg" style="max-width: 100%; height: auto;" alt="Responsive Image">
### ✅ **Clickable Image (Wrapped in `<a>`)**
<a href="https://www.google.com">
<img src="google-logo.png" width="200" alt="Google Logo">
</a>
### ✅ **Lazy Loading Image (`loading="lazy"`)**
<img src="image.jpg" loading="lazy" alt="Lazy Load Image">
📌 Image Attributes in HTML
Attribute | Description |
---|---|
src |
Specifies the image file path. |
alt |
Alternative text (shown if image fails to load). |
width |
Sets the image width. |
height |
Sets the image height. |
title |
Adds a tooltip when hovered. |
loading |
lazy (loads when visible) or eager (loads immediately). |
🎯 **Final Notes**
- Lists: `<ul>`, `<ol>`, `<dl>` for different types of lists.
- Colors: `named`, `hex`, `RGB`, `RGBA`, `HSL`, `HSLA`.
- `<a>` tag: Used for **links, email, phone, downloads**.
- `target` attribute: `_self`, `_blank`, `_parent`, `_top`.++
- `<audio>` & `<video>` for **media elements**.
Top comments (0)