Method #1: Use input id to bind
<!DOCTYPE html> <html lang = "en"> <head> <meta charset = "UTF-8"> <meta http-equiv = "X-UA-Compatible" content = "IE=edge"> <meta name = "viewport" content = "width=device-width, initial-scale=1.0"> <title> form </title> </head> <body> <form action = "" style = "display: grid;" method = "POST"> <div> <label for = "username"> Account: </label> <!-- Bind with id--> <input type = "text" id="username"> </div> </form> </body> </html>
Method #2: Put input tag inside of label tag.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Form</title> </head> <body> <form action="" style="display: grid;" method="POST"> <div> <label>Account: <input type="text"> </label> </div> </form> </body> </html>
The above is the detailed content of how to bind the label tag with the input tag.
For more information, please see other related articles and html tutorial on tutorialfish.com!