HTML Assignment Practical Practice List

 

1. Basic Unordered List

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Basic Unordered List</title> <style> ul { list-style-type: circle; font-family: Arial, sans-serif; } </style> </head> <body> <h2>Fruits</h2> <ul> <li>Apple</li> <li>Banana</li> <li>Cherry</li> </ul> </body> </html>

2. Ordered List with Custom Numbers

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Ordered List</title> <style> ol { list-style-type: upper-roman; color: darkblue; } </style> </head> <body> <h2>Steps to Bake a Cake</h2> <ol> <li>Preheat the oven</li> <li>Mix the ingredients</li> <li>Bake the cake</li> </ol> </body> </html>

3. Nested Lists

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Nested List</title> <style> ul { font-family: Verdana, sans-serif; } ul ul { list-style-type: square; margin-left: 20px; } </style> </head> <body> <h2>Grocery List</h2> <ul> <li>Fruits <ul> <li>Apple</li> <li>Banana</li> </ul> </li> <li>Vegetables <ul> <li>Carrot</li> <li>Broccoli</li> </ul> </li> </ul> </body> </html>

4. Horizontal List

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Horizontal List</title> <style> ul { display: flex; list-style: none; padding: 0; } li { margin: 0 10px; background-color: lightblue; padding: 5px 10px; border-radius: 5px; } </style> </head> <body> <h2>Navigation Menu</h2> <ul> <li>Home</li> <li>About</li> <li>Contact</li> </ul> </body> </html>

5. Styled Bullet Points

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Styled Bullets</title> <style> ul { list-style-type: none; padding: 0; } li::before { content: "✔ "; color: green; } </style> </head> <body> <h2>Checklist</h2> <ul> <li>Task 1</li> <li>Task 2</li> <li>Task 3</li> </ul> </body> </html>

6. Image Bullets

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Image Bullets</title> <style> ul { list-style-image: url('star.png'); } </style> </head> <body> <h2>Favorites</h2> <ul> <li>Pizza</li> <li>Burgers</li> <li>Ice Cream</li> </ul> </body> </html>

7. Hover Effects

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hover Effects</title> <style> ul { list-style: none; padding: 0; } li { padding: 5px; transition: background-color 0.3s ease; } li:hover { background-color: lightgray; } </style> </head> <body> <h2>Interactive List</h2> <ul> <li>Option 1</li> <li>Option 2</li> <li>Option 3</li> </ul> </body> </html>

8. Custom Indents

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Custom Indents</title> <style> ul { padding-left: 50px; } </style> </head> <body> <h2>Indented List</h2> <ul> <li>Item A</li> <li>Item B</li> <li>Item C</li> </ul> </body> </html>

9. Bordered List

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Bordered List</title> <style> ul { border: 2px solid black; padding: 10px; } li { margin-bottom: 5px; } </style> </head> <body> <h2>To-Do List</h2> <ul> <li>Task 1</li> <li>Task 2</li> <li>Task 3</li> </ul> </body> </html>

10. Colored List Items

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Colored List Items</title> <style> li:nth-child(odd) { background-color: lightyellow; } li:nth-child(even) { background-color: lightblue; } </style> </head> <body> <h2>Alternate Colors</h2> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> </body> </html>

Comments

Popular posts from this blog

History of Computer

Introduction to Computer

Computer Generation