HTML legend Tag

Last Updated :
Discuss
Comments

Question 1

What is the primary purpose of the legend tag in HTML?

  • To style form elements

  • To add a title or caption for a <fieldset>

  • To create a new form

  • To validate input fields

Question 2

Where should the legend tag be placed inside a fieldset?

  • At the end of the fieldset

  • As the first child inside the fieldset

  • Outside the fieldset

  • Before the form

Question 3

Which attribute of legend specifies the alignment of the legend text?

  • style

  • text-align

  • align

  • position

Question 4

Which of the following is a valid syntax for a legend?

  • <legend>Student Info</legend>

  • <legend/>Student Info

  • <legend>Student Info

  • <legend text="Student Info"></legend>

Question 5

Why is using legend Tag important for accessibility?

  • It changes the color of form fields

  • It provides context for grouped form controls, helping screen readers

  • It automatically validates inputs

  • It adds borders to the fieldset

Question 6

Which of the following is true about styling legend ?

  • It cannot be styled with CSS

  • CSS properties like background-color, border, padding, and color can be applied

  • Only font-size can be applied

  • It must use inline styles

There are 6 questions to complete.

Take a part in the ongoing discussion