edw*_*rkf 2 html javascript css jquery html5
是否可以在input字段的占位符属性中使用HTML效果?例如,以下是输入字段占位符的输出吗?
正常的大胆
可以使用CSS自定义占位符,::placeholder但它适用于其中的所有文本.如何调整它就像HTML一样?
我想你可以创建一个"占位符"效果来做你想做的事情.像这样:
.inputBox {
position: relative;
display: inline-block;
}
.placeholder {
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 2px;
width: 100%;
height: 100%;
pointer-events: none;
opacity: 0.85;
}
.inputBox input:focus+.placeholder {
display: none;
}
.inputBox input:valid+.placeholder {
display: none;
}Run Code Online (Sandbox Code Playgroud)
<div class="inputBox">
<input type="text" required />
<div class="placeholder"><span style="font-weight: bold">Bold</span> <span>Text</span><!-- your html here --></div>
</div>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
96 次 |
| 最近记录: |