The HTML

is used as a caption for an item. For example, if there is a form and we want to tell our user, this input is for username, this input is for password. Maybe we need to add caption Username and Password in front of form elements, and like this:

image.png

Then we need to use element to implement this. Here is my code:

   

if we don't want to place inside , we can use for attribute to associate them, just like this:

    

attention: the value of for attribute is the related form element's id.

你可能感兴趣的:(