html 占位符中的元素
html element in placeholder
我有这个输入
<input class="form-control input-lg" type="text" placeholder="Name" name="name">
由于我的表单没有标签并且我依赖于占位符,是否可以放置一个像
这样的元素
<sup>*</sup>
这样我就可以向用户表明该字段是必需的。
我试过了,但没用。
有办法吗?
我的表格
使用标签:
<input class="form-control input-lg" type="text" placeholder="Name" name="name">
<label for="Name">*</label>
或者您可以在占位符文本后添加 *。有什么理由不使用标签?他们是很好的做法
如果您不想使用标签:
css code:
.required::before {
content: "*";
color:red;
}
html code:
<span class="required"></span>
<input class="form-control input-lg" type="text" placeholder="Name" name="name">
我有这个输入
<input class="form-control input-lg" type="text" placeholder="Name" name="name">
由于我的表单没有标签并且我依赖于占位符,是否可以放置一个像
这样的元素<sup>*</sup>
这样我就可以向用户表明该字段是必需的。
我试过了,但没用。
有办法吗?
我的表格
使用标签:
<input class="form-control input-lg" type="text" placeholder="Name" name="name">
<label for="Name">*</label>
或者您可以在占位符文本后添加 *。有什么理由不使用标签?他们是很好的做法
如果您不想使用标签:
css code:
.required::before {
content: "*";
color:red;
}
html code:
<span class="required"></span>
<input class="form-control input-lg" type="text" placeholder="Name" name="name">