<input type="password" name="password", placeholder="密码">其中placehodler是什么
时间: 2023-07-19 17:50:41 浏览: 49
placeholder是一个HTML5的属性,用于在表单控件中显示一些提示文本。通常在输入框中,当用户未输入任何内容时,该属性可以显示预先设置的文本,以提供关于输入的内容的提示或说明,而当用户开始在输入框中输入内容时,该预先设置的文本将自动消失。在这个例子中,placeholder是"密码",当用户未输入密码时,该属性将在输入框中显示"密码"这个提示文本。
相关问题
<input type="" name="" value="" />
<input>标签是HTML中最常用的表单元素之一,它可以创建多种不同类型的表单控件,例如文本框、单选框、复选框等等。下面是一些<input>标签的常见类型和用法:
1.文本框
```html
<input type="text" name="username" placeholder="请输入用户名">
```
2.密码框
```html
<input type="password" name="password" placeholder="请输入密码">
```
3.单选框
```html
<input type="radio" name="gender" value="1" disabled>
<span>男</span>
<input type="radio" name="gender" value="0" disabled>
<span>女</span>
```
4.复选框
```html
<input type="checkbox" name="hobby" value="reading">
<span>阅读</span>
<input type="checkbox" name="hobby" value="music">
<span>音乐</span>
```
5.提交按钮
```html
<input type="submit" value="提交">
```
6.重置按钮
```html
<input type="reset" value="重置">
```
7.隐藏域
```html
<input type="hidden" name="id" value="123">
```
8.文件上传
```html
<input type="file" name="file">
```
9.日期选择器
```html
<input type="date" name="date">
```
10.颜色选择器
```html
<input type="color" name="color">
```
11.搜索框
```html
<input type="search" name="search" placeholder="请输入搜索内容">
```
<form action="register.action" method="post"> <div class="register-top-grid"> <h3>注册新用户</h3> <div class="input"> <span>用户名 <label style="color:#15ec72;">不能为空</label></span> <input type="text" name="uname" placeholder="请输入用户名" required="required"> </div> <div class="input"> <span>真实姓名 <label style="color:#15ec72;">不能为空</label></span> <input type="text" name="urealname" placeholder="请输入真实姓名" required="required"> </div> <div class="input"> <span>密码 <label style="color:#15ec72;">不能为空</label></span> <input type="password" name="upwd" placeholder="请输入密码" required="required"> </div> <div class="input"> <span>收货电话<label></label></span> <input type="text" name="uphone" placeholder="请输入收货电话"> </div> <div class="input"> <span>收货地址<label></label></span> <input type="text" name="uaddress" placeholder="请输入收货地址"> </div> <div class="clearfix"> </div> </div> <div class="register-but text-center"> <input type="submit" value="提交"> <div class="clearfix"> </div> </div> </form>
好的,请看下面美化过的代码:
```html
<form action="register.action" method="post">
<div class="register-top-grid">
<h3>注册新用户</h3>
<div class="input">
<span>用户名 <label style="color:#15ec72;">不能为空</label></span>
<input type="text" name="uname" placeholder="请输入用户名" required="required">
</div>
<div class="input">
<span>真实姓名 <label style="color:#15ec72;">不能为空</label></span>
<input type="text" name="urealname" placeholder="请输入真实姓名" required="required">
</div>
<div class="input">
<span>密码 <label style="color:#15ec72;">不能为空</label></span>
<input type="password" name="upwd" placeholder="请输入密码" required="required">
</div>
<div class="input">
<span>收货电话<label></label></span>
<input type="text" name="uphone" placeholder="请输入收货电话">
</div>
<div class="input">
<span>收货地址<label></label></span>
<input type="text" name="uaddress" placeholder="请输入收货地址">
</div>
<div class="clearfix"></div>
</div>
<div class="register-but text-center">
<input type="submit" value="提交">
<div class="clearfix"></div>
</div>
</form>
```
代码美化后更加清晰易读,缩进、空格等都被处理得很好。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
<form action="{{ url_for('auth.login') }}" class="form" id="form1" method="POST"> 注册 <input type="text" placeholder="用户名账号" class="input" name="username" /> <input type="email" placeholder="邮箱" class="input" name="email"/> <input type="password" placeholder="密码" class="input" name="password"/> <button class="btn" type="submit" name="register_submit" onclick="submitForm()">注册</button> </form> <form action="{{ url_for('auth.login') }}" class="form" id="form2" method="POST"> 登录 <input type="email" placeholder="邮箱" class="input" name="email"/> <input type="password" placeholder="密码" class="input" name="password"/> 忘记密码? <button class="btn" type="submit" name="login_submit" onclick="submitForm()">登录</button> </form> 为什么提交后表单中没有“register_submit”或“login_submit”
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
把一下代码生成流程图 <!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>register</title> <script src="js/zone.js"></script> </head> <body> 注册 用户名: <input type="text" id="username" autocomplete="off" placeholder="输入姓名"> 密码 <input type="password" id="password" placeholder="输入密码"> 确认密码 <input type="password" id="repwd" placeholder="确认密码"> <input type="button" value="注册" id="register" onclick="reg()"> 登录 </body> </html>
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
<form action="{{ url_for('auth.login') }}" class="form" id="form1" method="POST"> 注册 <input type="text" placeholder="用户名账号" class="input" name="username" /> <input type="email" placeholder="邮箱" class="input" name="email"/> <input type="password" placeholder="密码" class="input" name="password"/> <input type="hidden" name="register_submit" value="register_submit"> <button class="btn" type="submit" name="register_submit" onclick="submitForm()">注册</button> </form> <form action="{{ url_for('auth.login') }}" class="form" id="form2" method="POST"> 登录 <input type="email" placeholder="邮箱" class="input" name="email"/> <input type="password" placeholder="密码" class="input" name="password"/> 忘记密码? <input type="hidden" name="login_submit" value="login_submit"> <button class="btn" type="submit" name="login_submit" onclick="submitForm()">登录</button> </form> 为什么点登录仍然会提交到注册
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)