是一个自动关闭的标签,你
cannot有任何:before或:after伪元素.你可以把它包装成< label>或者< span>所以并把它附在那里.
.start_date:before {
font-family: "FontAwesome";
content: "\f073";
}
.start_date:before,
.start_date input {
vertical-align: middle;
}
以下是将图标放在输入字段内的示例.
.start_date {
position: relative;
}
.start_date:before {
font-family: "FontAwesome";
font-size: 14px;
content: "\f073";
position: absolute;
left: 4px;
top: 50%;
transform: translateY(-50%);
}
.start_date input {
text-indent: 18px;
}