如果不加label的话,只设置值的话,点击文字是不能将编辑的光标移过来的,必须将id连接上之后,才可以实现,点击文字就可以将编辑的光标移过来。
实现结果:
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>逆水行舟不进则退</title>
</head>
<body>
<label for="user">用户名:</label>
<input id="user" type="text" name="user">
<label for="pass">密码:</label>
<input id="pass" type="password" name="password">
</body>
</html>
我们可以发现,现在我们点击用户名三个字,同样可以将编辑的光标移过来