Top 50 HTML Interview Questions with Answers

HTML Interview Questions with Answers

1. What does HTML stand for?

a) Hyper Text Markup Language
b) Higher Text Markup Language
c) Hyperspace Text Markup Language
d) Home Text Marking Language

Answer: a)

2. Which is the use of the img tag?

a) Insert an image
b) Create a hyperlink
c) Create a table
d) None of the above

Answer: a)

3. Which tag is used to define unordered list?

a) ul
b) ol
c) li
d) div

Answer: a)

4. Which is the correct syntax for creating a hyperlink?

a) <a href="https://www.example.com">Example</a>
b) <a src="https://www.example.com">Example</a>
c) <a link="https://www.example.com">Example</a>
d) <a target="https://www.example.com">Example</a>

Answer: a)

5. What is the use of the alt attribute in the img tag?

a) To define the size of the image
b) To define the width of the image
c) To define a description of the image
d) None of the above

Answer: c)

6. Which is the correct way to define a paragraph in HTML?

a) <par>
b) <pt>
c) <p>
d) <para>

Answer: c)

7. What is the use of the tag in HTML?

a) To define the main content of the webpage
b) To define the footer of the webpage
c) To define the title and meta information of the webpage
d) To define the body of the webpage

Answer: c)

8. Which is the correct way to define a table in HTML?

a) <tbl>
b) <tb>
c) <table>
d) <tab>

Answer: c)

9. Which tag defines the header of a table?

a) <thead>
b) <th>
c) <header>
d) <table>

Answer: a)

10. Which tag defines a line break?

a) <br>
b) <lb>
c) <break>
d) <new>

Answer: a)

11. Which tag is used to define a hyperlink?

a) <a>
b) <h>
c) <p>
d) <b>


d) Answer: a)

12. Which tag is used to make text bold?

a)
b)
c)
d) Answer: b)

13. Which tag is used to define a form?

a)
b)
c)
d)

Answer: c)

14. Which attribute is used to define the type of input in the input tag?

a) value
b) type
c) name
d) id

Answer: b)

15. Which input type is used for selecting multiple options?

a) select
b) checkbox
c) radio
d) multi-select

Answer: a)

16. Which tag is used for text input?

a)
b)
c)
d) Answer: d)

17. What is the use of the label tag?

a) To define a title for the webpage
b) To define a title for the form element
c) To define a caption for a table
d) None of the above

Answer: b)

18. Which attribute is used to define the width of a table?

a) width
b) col
c) size
d) table-width

Answer: a)

19. Which attribute is used to merge cells in a table?

a) col
b) colspan
c) row
d) rowspan

Answer: d)

20. Which tag is used to define a list item?

a) <ul>
b) <ol>
c) <li>
d) <list>

Answer: c)

21. Which tag is used to create a dropdown list in a form?

a) <dropdown>
b) <list>
c) <select>
d) <menu>

Answer: c)

22. Which attribute is used to define the height of an image?

a) width
b) height
c) h
d) img-height

Answer: b)

23. Which input type is used for radio buttons?

a) select
b) checkbox
c) radio
d) multi-select

Answer: c)

24. Which tag is used to define an ordered list?

a) <ul>
b) <ol>
c) <li>
d) <list>

Answer: b)

25. Which attribute is used to define a link target in the a tag?

a) target
b) link
c) href
d) src

Answer: a)

26. Which tag defines a horizontal line?

a) <hr>
b) <line>
c) <hline>
d) <horz>

Answer: a)

27. Which tag is used to create a text area in a form?

a) <textarea>
b) <input>
c) <text>
d) <area>

Answer: a)</h4>

28. Which tag is used to define a text heading?

a) <title>
b) <h>
c) <head>
d) <header>

Answer: b)

29. Which attribute is used to define a color in HTML?

a) color
b) col
c) bgcolor
d) background

Answer: c)

30. Which tag is used for italic text?

a) <italic>
b) <i>
c) <em>
d) <italic-text>

Answer: b)

31. What does CSS stand for?

a) Computer Style Sheets
b) Creative Style Sheets
c) Cascading Style Sheets
d) Colorful Style Sheets

Answer: c)

32. Which property is used to change the background color in CSS?

a) color
b) background-color
c) bgcolor
d) background

Answer: b)

33. Which property is used to change the font size in CSS?

a) font
b) font-size
c) text-size
d) size

Answer: b)

34. Which property is used to set the border style in CSS?

a) border
b) border-size
c) border-style
d) None of the above

Answer: a)

35. Which property is used to set the text color in CSS?

a) text-color
b) color
c) font-color
d) None of the above

Answer: b)

36. Which property is used to center align text in CSS?

a) center
b) text-center
c) align
d) text-align

Answer: d)

37. Which property is used to set the text decoration in CSS?

a) decoration
b) text-decoration
c) underline
d) None of the above

Answer: b)

38. Which property is used to set the display style in CSS?

a) display
b) style
c) visibility
d) None of the above

Answer: a)

39. Which property is used to set the margin in CSS?

a) margin
b) margin-size
c) size
d) None of the above

Answer: a)

40. Which property is used to set the padding in CSS?

a) padding
b) padding-size
c) size
d) None of the above

Answer: a)

41. Which property is used to set the text alignment in CSS?

a) align
b) text-align
c) center
d) None of the above

Answer: b)

42. Which property is used to set the font-family in CSS?

a) family
b) font
c) font-family
d) None of the above

Answer: c)

43. Which property is used to set the font-style in CSS?

a) style
b) font-style
c) font-family
d) None of the above

Answer: b)

44. Which property is used to set the font-weight in CSS?

a) weight
b) font-weight
c) font-size
d) None of the above

Answer: b)

45. Which property is used to set the background image in CSS?

a) background-image
b) background
c) image
d) None of the above

Answer: a)

46. Which property is used to set the text transform in CSS?

a) transform
b) text-transform
c) None of the above
d) Both a and b

Answer: b)

47. Which property is used to set the font variant in CSS?

a) variant
b) font-variant
c) None of the above
d) Both a and b

Answer: b)

48. What is the use of the float property in CSS?

a) To position an element
b) To adjust the font size
c) To set the background color
d) None of the above

Answer: a)

49. What is the use of the z-index property in CSS?

a) To set the width of an element
b) To set the height of an element
c) To set the position of an element
d) To set the stacking order of an element

Answer: d)

50. What is the use of the position property in CSS?

a) To set the color of an element
b) To set the visibility of an element
c) To set the position of an element
d) None of the above

Answer: c)

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x