Home >Daily Programming >HTML Knowledge >How to bind label label to input label

How to bind label label to input label

autoload
autoloadOriginal
2021-03-31 14:03:237640browse

How to bind label label to input label

1. Method one:

<!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>表单</title>
</head>
<body>
   <form action="" style="display: grid;" method="POST">
     <div>
            <label for="username">账号:</label>  <!-- 利用id进行绑定 -->
            <input type="text" id="username">        
     </div>
   </form>
</body>
</html>

Method two:

<!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>表单</title>
</head>
<body>
   <form action="" style="display: grid;" method="POST">
     <div>
            <label>账号:<input type="text" >  </label>
                  
     </div>
   </form>
</body>
</html>

Recommendation: "The most popular 5 html5 video tutorial recommendations"

The above is the detailed content of How to bind label label to input label. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn