使用 CSS 设置元素文本是否可选中

cssweb developmentfront end technology更新于 2024/10/19 8:12:17

使用 CSS user-select 属性设置元素文本是否可选中:

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            user-select: none;
         }
      </style>
   </head>
   <body>
      <h2>This is demo heading</h2>
      <div>This is demo text. You won't be able to select it.</div>
   </body>
</html>

相关文章


有用资源