HTML Practice – Questions & Answers
Beginner Level – Part 2
Q31. What is the use of <title> tag?
Answer: The <title> tag defines the title of the web page shown in the browser tab.
Q32. Which tag is used to display an image?
Answer: <img>
Q33. Write HTML code for bold and italic text.
<b>Bold Text</b> <i>Italic Text</i>
Q34. What is the difference between <br> and <hr>?
Answer:
<br> inserts a line break.
<hr> inserts a horizontal line.
Q35. Which tag is used to create a comment in HTML?
<!-- This is a comment -->
Intermediate Level – Part 2
Q36. What is the use of alt attribute in images?
Answer: It provides alternate text if the image fails to load and improves accessibility.
Q37. Write HTML code for an ordered list.
<ol> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ol>
Q38. Write HTML code for an unordered list.
<ul> <li>Apple</li> <li>Banana</li> </ul>
Q39. How do you create a checkbox and radio button?
<input type="checkbox"> HTML <input type="radio" name="lang"> CSS
Q40. What is iframe used for?
Answer: The <iframe> tag is used to embed another webpage or video inside a webpage.
Advanced Level – Part 2
Q41. What is the difference between <div> and <span>?
Answer:
<div> is a block-level element.
<span> is an inline element.
Q42. What is the purpose of data-* attributes?
Answer: They store custom data that can be accessed using JavaScript.
Q43. Write HTML code to validate a phone number.
<input type="tel" pattern="[0-9]{10}" required>
Q44. What is the use of meta viewport?
Answer: It makes the website responsive on different screen sizes.
Q45. Write HTML5 audio tag example.
<audio controls> <source src="audio.mp3" type="audio/mpeg"> </audio>
No comments:
Post a Comment