【问题标题】:Is it possible to add a pseudo after selector to the placeholder of an input是否可以将伪后选择器添加到输入的占位符
【发布时间】:2025-12-13 06:20:03
【问题描述】:

我正在尝试在占位符文本的末尾添加一个很棒的字体图标,我知道 this method 有效,但它让我想知道通过 css 添加字体真棒内容代码是否有效。

这样的事情可能吗:

input::-webkit-input-placeholder::after

【问题讨论】:

  • 你试过了吗?
  • 是的,没有运气,正在寻找替代品

标签: html css font-awesome


【解决方案1】:

input::-webkit-input-placeholder::after 无效,因为input 没有内部内容 - 没有:before:after

你不能选择伪元素的伪元素。所以input:placeholder:after 会选择:afterinput

【讨论】:

  • 那么有没有其他方法可以在输入的占位符之后添加一些东西
  • @Jeevan Nop。但是试试这个:*.com/questions/34842889/…
最近更新 更多