我应该用什么标签用于文字? HTML5

时间:2017-12-06 23:25:19

标签: html css

我应该使用什么标签来处理少量文字。例如,对每个"小"使用p标签是一种好习惯。像这里的文字"用户名"和密码"或者对于日/月/年,我应该使用p标签吗?

<div class="login-area">
    <p>Username:</p>
    <input type="text">   
    <p>Password:</p> 
    <input type="password">
</div>

2 个答案:

答案 0 :(得分:3)

使用

<label for="name">Your Form label</label>
<input type="text" name="name">   

<label for="password">Your Form label</label>
<input type="password" name="password>

答案 1 :(得分:0)

正如其他人所说,<label></label>标签是您可以使用的其他选项。

其中一些用例如下:

&#13;
&#13;
<input type="text" id="lastname" />
<label for="lastname">Last Name</label>
&#13;
&#13;
&#13;

&#13;
&#13;
<label>
   Name : <input type="text" name="lastname" />
</label>
&#13;
&#13;
&#13;

&#13;
&#13;
<label for="lastname">Last Name</label>
<input type="text" id="lastname" />
&#13;
&#13;
&#13;

相关问题