Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法改变文本框中选择突出显示的颜色?我可以使用 CSS 来实现吗?
所选文本 (::selection) 有一个 CSS3 属性,但它在 Chrome 或 Safari 中的 input 或 textarea 标签内不起作用。它仅适用于 Firefox。
见textarea::selection 和 ::-moz-selection
是的,是的。
您可以使用 CSS 伪类:focus
:focus
例子:
input:focus{ border: 5px solid blue; background: green; }
工作演示