CSS user-select:none
禁用元素或整个文档中的所有文本选择,但我不知道如何禁用行之间或元素之间的选择。
<body>
<input value="Ctrl + A">Outside the input<br>There's a character selected after the A and another after the input.
</body>
我已经尝试将文本放在<span>
中,禁用正文中的选择并在元素中启用它,但这会禁用它的正常选择。如果我点击身体并拖过跨度,它就不会逐个字符地选择。
示例如何(顶部)以及我希望它看起来如何(底部):