最佳答案
这就是您可以使用 CSS 在 html 中突出显示文本的方法。当您拖动文本时,文本将突出显示
<head>
<style>
::-moz-selection { /* Code for Firefox */
color: red;
background: yellow;
}
::selection {
color: red;
background: yellow;
}
</style>
</head>
<body>
<h1>Select some text on this page:</h1>
<p>This is a paragraph.</p>
<div>This is some text in a div element.</div>
<p><strong>Note:</strong> ::selection is not supported in Internet Explorer 8 and earlier versions.</p>
<p><strong>Note:</strong> Firefox supports an alternative, the ::-moz-selection property.</p>
</body>
</html>
关于css - 如何使用CSS突出显示选定的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51173595/