A text label is bound to a particular form input element via the <label> tag. Because it enables screen readers to read out what the label is related to, improving user context, this is essential for accessibility. For sighted users, labels are especially helpful since they can be clicked to focus on or activate the corresponding input, improving the user experience.
Attributes of <label>:
Accessible Form Example:
<form action="/submit-form" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<label for="useremail">Email:</label>
<input type="email" id="useremail" name="email" required>
<label for="userpassword">Password:</label>
<input type="password" id="userpassword" name="password" required>
<input type="submit" value="Register">
</form>
A text label is bound to a particular form input element via the <label> tag. Because it enables screen readers to read out what the label is related to, improving user context, this is essential for accessibility. For sighted users, labels are especially helpful since they can be clicked to focus on or activate the corresponding input, improving the user experience.
Attributes of <label>:
Accessible Form Example:
<form action="/submit-form" method="post"> <label for="username">Username:</label> <input type="text" id="username" name="username"> <label for="useremail">Email:</label> <input type="email" id="useremail" name="email" required> <label for="userpassword">Password:</label> <input type="password" id="userpassword" name="password" required> <input type="submit" value="Register"> </form>
Use the <link> tag inside the <head> to attach an external CSS file.
Comments in HTML are written between <!-- and -->.
HTML entities are used to display reserved or special characters.
The <iframe> tag embeds another webpage within the current page.
The id attribute uniquely identifies a single HTML element.
Hyperlinks are created using the <a> tag with an href attribute.
Use the <img> tag and specify the image source with the src attribute.
Use the target="_blank" attribute inside the <a> tag.
Copyrights © 2024 letsupdateskills All rights reserved