Mar*_*ark 6 html css css3 pseudo-element
我正在使用一种服务,它返回带有一系列标签和输入的动态HTML,例如
input:after {
content: "\a";
white-space: pre;
}Run Code Online (Sandbox Code Playgroud)
<label for="username">Username</label>
<input type="text" id="username" name="username" />
<label for="country">Country</label>
<input type="text" id="country" name="country" />Run Code Online (Sandbox Code Playgroud)
我希望表单格式如下:

但它不起作用.不能使用div包围标签和输入,因为这是由服务返回给我的动态HTML.
任何想法如何只能通过CSS实现?
Sti*_*ers 11
替换元素包括<img>,<object>,<input>,和<textarea> ......没有:before和:after伪元素.
作为解决方法,您可以在<label>元素上设置换行符.
label:before {
content: "\a";
white-space: pre;
}Run Code Online (Sandbox Code Playgroud)
<label for="username">Username</label>
<input type="text" id="username" name="username" />
<label for="country">Country</label>
<input type="text" id="country" name="country" />Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6321 次 |
| 最近记录: |