我想在input
后面选择一个span
代码:
HTML:
<input type="text"/>
<span>
...
</span>
CSS:
input [followed span] {
padding:5px; (set input padding, only when followed by span)
}
答案 0 :(得分:2)
使用此css:
.wrapper {
position: relative;
}
input {
padding-left: 48px;
}
.wrapper span {
position: absolute;
left: 2px;
}
HTML:
<div class="wrapper">
<input type="url" placeholder="e.g. www.google.com" />
<span>http://</span>
</div>