用 CSS 設定元素的文字是否可以選擇


使用 CSS user-select 屬性來設定元素的文字是否可以用 CSS 選擇

示例

即時演示

<!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>

更新時間:2020 年 6 月 25 日

87 次觀看

開啟你的 事業

透過完成課程獲得認證

開始
廣告