Show List

HTML Coding Questions

Exercise : Create an HTML document with a title that says "My First HTML Document".

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>My First HTML Document</title> </head> <body> <h1>Hello World!</h1> <p>This is my first HTML document.</p> </body> </html>

Exercise : Create an HTML document with a heading that says "My Favorite Foods" and a bulleted list of three of your favorite foods.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>My Favorite Foods</title> </head> <body> <h1>My Favorite Foods</h1> <ul> <li>Pizza</li> <li>Sushi</li> <li>Ice cream</li> </ul> </body> </html>

Exercise : Create an HTML document with a form that asks for a user's name and email address.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>User Information</title> </head> <body> <h1>User Information</h1> <form> <label for="name">Name:</label> <input type="text" id="name" name="name"><br> <label for="email">Email:</label> <input type="email" id="email" name="email"><br> <input type="submit" value="Submit"> </form> </body> </html>

Exercise : Create an HTML document with a table that displays the names, ages, and favorite colors of three people.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>People Information</title> </head> <body> <h1>People Information</h1> <table> <tr> <th>Name</th> <th>Age</th> <th>Favorite Color</th> </tr> <tr> <td>John</td> <td>32</td> <td>Blue</td> </tr> <tr> <td>Jane</td> <td>26</td> <td>Green</td> </tr> <tr> <td>Bob</td> <td>42</td> <td>Red</td> </tr> </table> </body> </html>

Exercise : Create an HTML document with an image of your favorite animal and a caption that describes the animal.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>My Favorite Animal</title> </head> <body> <h1>My Favorite Animal</h1> <img src="https://www.example.com/images/my-favorite-animal.jpg" alt="My favorite animal"> <p>This is my favorite animal because it is cute and fluffy.</p> </body> </html>

Exercise : Create an HTML document with a heading that says "About Me" and three paragraphs that describe yourself.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>About Me</title> </head> <body> <h1>About Me</h1> <p>Hi, my name is John and I am a web developer.</p> <p>I enjoy coding, hiking, and playing video games.</p> <p>My favorite programming language is JavaScript.</p> </body> </html>

Exercise : Create an HTML document with an ordered list of five of your favorite movies.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>My Favorite Movies</title> </head> <body> <h1>My Favorite Movies</h1> <ol> <li>The Shawshank Redemption</li> <li>The Godfather</li> <li>The Dark Knight</li> <li>Forrest Gump</li> <li>The Matrix</li> </ol> </body> </html>

Exercise : Create an HTML document with a form that asks for a user's username, password, and favorite color.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>User Information</title> </head> <body> <h1>User Information</h1> <form> <label for="username">Username:</label> <input type="text" id="username" name="username"><br> <label for="password">Password:</label> <input type="password" id="password" name="password"><br> <label for="color">Favorite Color:</label> <input type="color" id="color" name="color"><br> <input type="submit" value="Submit"> </form> </body> </html>

Exercise : Create an HTML document with a table that displays the names and prices of three products.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>Product Information</title> </head> <body> <h1>Product Information</h1> <table> <tr> <th>Product Name</th> <th>Price</th> </tr> <tr> <td>Product 1</td> <td>$9.99</td> </tr> <tr> <td>Product 2</td> <td>$19.99</td> </tr> <tr> <td>Product 3</td> <td>$29.99</td> </tr> </table> </body> </html>

Exercise : Create an HTML document with an image of your favorite place and a caption that describes the place.

Answer:

php
Copy code
<!DOCTYPE html> <html> <head> <title>My Favorite Place</title> </head> <body> <h1>My Favorite Place</h1> <img src="https://www.example.com/images/my-favorite-place.jpg" alt="My favorite place"> <p>This is my favorite place because it is peaceful and beautiful.</p> </body> </html>



    Leave a Comment


  • captcha text