HTML Practice – Questions & Answers
Beginner Level
Q16. What is HTML?
Answer: HTML stands for HyperText Markup Language. It is used to create the structure of web pages.
Q17. Write a basic HTML document structure.
<!DOCTYPE html> <html> <head> <title>My Page</title> </head> <body> Content here </body> </html>
Q18. Which tag is used for the largest heading?
Answer: <h1>
Q19. Write HTML code to display a paragraph.
<p>This is a paragraph</p>
Q20. Which tag is used to insert a line break?
Answer: <br>
Intermediate Level
Q21. How do you create a hyperlink in HTML?
<a href="https://www.google.com">Visit Google</a>
Q22. How do you open a link in a new tab?
<a href="https://example.com" target="_blank">Open Link</a>
Q23. Write HTML code to insert an image.
<img src="image.jpg" alt="Sample Image">
Q24. Create a simple HTML table.
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Vijay</td>
<td>25</td>
</tr>
</table>
Q25. Write HTML code for a login form.
<form> <input type="text" placeholder="Username"><br> <input type="password" placeholder="Password"><br> <input type="submit"> </form>
Advanced Level
Q26. What are semantic HTML tags?
Answer: Semantic tags clearly describe their meaning, such as <header>, <nav>, <section>, <article>, <footer>.
Q27. Create a basic semantic page layout.
<header>Header</header> <nav>Menu</nav> <section> <article>Content</article> </section> <footer>Footer</footer>
Q28. What is the use of id and class attributes?
Answer: id is unique and used for a single element. class can be used for multiple elements.
Q29. Write an input field with validation.
<input type="email" required placeholder="Enter email">
Q30. Create a mini HTML website structure.
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<header>
<h1>My Website</h1>
</header>
<main>
<section>
<article>Welcome Content</article>
</section>
</main>
<footer>
© 2025
</footer>
</body>
</html>
No comments:
Post a Comment