In HTML5, the tag is self-closing and does not require a closing slash. Option C is correct. Options A and B include a slash which is optional but not required in HTML5. Option C incorrectly uses a closing tag which is invalid for
.
<input type="text" value="Hello">
<input type="text" value="Hello">
The tag creates an interactive text box. The value attribute sets the initial text inside the box. So the browser shows a text input box with 'Hello' inside.
HTML5 allows self-closing tags like
and to be written without a closing slash. The slash is optional and mostly used for compatibility with XHTML. Attributes are allowed, and these tags do not have separate closing tags.
Self-closing tags like do not have child elements, but they are still selected simply by their tag name. The selector 'input' targets all input elements regardless of being self-closing. The other selectors either look for children or pseudo-elements which do not apply here.
The alt attribute provides a text description of the image for screen readers and improves accessibility. Using a closing tag for is invalid HTML. Avoiding alt attributes or hiding images from screen readers reduces accessibility.