Page 107 - HTML5
P. 107

<label for="username" form="my-form">Username:</label>



        About Label


        The <label> element is used to reference a form action element.
        In the scope of User Interface it's used to ease the target / selection of elements like Type radio
        or checkbox.

        <label> as wrapper


        It can enclose the desired action element


         <label>
             <input type="checkbox" name="Cats">
             I like Cats!
         </label>


        (Clicking on the text the target input will toggle it's state / value)


        <label> as reference

        Using the for attribute you don't have to place the control element as descendant of label - but the
        for value must match it's ID


         <input id="cats" type="checkbox" name="Cats">
         <label for="cats" >I like Cats!</label>


        Note
        Don't use more than one Control Element within a <label> element

        Read Label Element online: https://riptutorial.com/html/topic/1704/label-element






































        https://riptutorial.com/                                                                               91
   102   103   104   105   106   107   108   109   110   111   112