简体   繁体   English

我应该为文字使用什么标签? html5

[英]what tag should i use for text? html5

What tag should i use for small amount of text. 少量文字应使用什么标签。 For example it is good practise to use p tag for every "small" text like here "username" and pasword" or for day/month/year, should i use also p tag? 例如,对于每个“小”文本(如此处的“用户名”和“密码”)或日/月/年,都应使用p标签,这是一种好习惯,我是否也应使用​​p标签?

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

Use 采用

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

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

As Others have suggested <label></label> tag is other option that you can use. 正如其他人所建议的那样,您可以使用<label></label>标签。

Some of it's use cases are as follows: 它的一些用例如下:

 <input type="text" id="lastname" /> <label for="lastname">Last Name</label> 

 <label> Name : <input type="text" name="lastname" /> </label> 

 <label for="lastname">Last Name</label> <input type="text" id="lastname" /> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM