当在输入上应用 ::before 时,它不会。所以我做了一些搜索,一些答案澄清说,因为它是一个替换元素 ::before 或 ::after 对它们不起作用。
现在,当我在输入上使用外观:无时,::before 适用于复选框和收音机,但不适用于输入:文本。有人能告诉我外观对输入元素有什么魔力吗。
我尝试在互联网上搜索,但找不到有用的东西
考虑下面的一段代码:
input {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
position: relative;
}
input::before {
content: "X";
width: 10px;
height: 10px;
display: block;
outline: 4px solid orange;
position: absolute;
top: 20px;
left: 50px;
}
<input type="text" name="" id="">
<input type="checkbox" name="" id="">