<分区>
为什么 :before 和 :after 在 input type='submit'
上不起作用
这是我的代码
input.submit:before {
display: inline-block;
-webkit-font-smoothing: antialiased;
font: normal 18px/1 'Genericons';
content: '\f400';
}
<分区>
为什么 :before 和 :after 在 input type='submit'
上不起作用
这是我的代码
input.submit:before {
display: inline-block;
-webkit-font-smoothing: antialiased;
font: normal 18px/1 'Genericons';
content: '\f400';
}
最佳答案
这是因为 :before
和 :after
只适用于可以有子节点的节点。在您的情况下,使用按钮会起作用,因为它可以采用 HTML。
5.12.3 The :before and :after pseudo-elements
The ':before' and ':after' pseudo-elements can be used to insert generated content before or after an element's content.
由于input不能有内容,所以不支持
关于html - :before :after not working on the input type submit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24365580/