作者:清醒还是迷惘_123 | 来源:互联网 | 2023-01-06 20:27
HereisaninterestingCSSquestionsforyou!这是一个有趣的CSS问题!Ihaveatextareawithatransparentb
Here is an interesting CSS questions for you!
这是一个有趣的CSS问题!
I have a textarea with a transparent background overlaying some TEXT that I'd like to use as a sort of watermark. The text is large and takes up a majority of the textarea. It looks nice, the problem is when the user clicks in the textarea it sometimes selects the watermark text instead. I want the watermark text to never be selectable. I was expecting if something was lower in the z-index it would not be selectable but browsers don't seem to care about z-index layers when selecting items. Is there a trick or way to make it so this DIV is never selectable?
我有一个带有透明背景的文本区域,上面覆盖了一些我想用作水印的文本。文本很大,占据了大部分文本区域。它看起来不错,问题是当用户点击文本区域时,它有时会选择水印文本。我希望水印文本永远不能被选择。我原以为,如果z索引中的某个值较低,它就不能被选择,但浏览器在选择项时似乎并不关心z索引层。有没有什么办法可以让这个DIV永远不能选择?
12 个解决方案