css – ::之前在Firefox中输入
作者:互联网
2026-03-29
参见英文答案 > CSS content generation before or after ‘input’ elements 5个 我正在尝试使用CSS伪类::之前在输入标记之前放置一些内容.它适用于Chrome,但不适用于Firefox. Firefox似乎有什么问题?
这是一个片段:
input::before { content: ''; display: block; width: 13px; height: 13px; border-radius: 50%; box-shadow: 0px 0px 5px #9F0002 inset;} malefemale
……这就是结果. Chrome工作得很好:
但Firefox没有变化:
根据 specification.Authors specify the style and location of generated content with the :before and :after pseudo-elements. As their names indicate, the :before and :after pseudo-elements specify the location of content before and after an element’s document tree content. The ‘content’ property, in conjunction with these pseudo-elements, specifies what is inserted.
:before和:after应该只对可以充当内容容器的元素起作用. <输入>不能包含任何内容,因此它不应该支持那些伪元素. Chrome支持,因为它不符合规范(或错误?).
相关推荐
