首页 » 网页制作 » css

??CSS??ν??????????????????

css 2021-12-20

???

????????????????????????????????????????????????????в??????????????????????????????????????????????????????????????????????????????????????????????????????????????CSS??????JS????????????????????CSS3?е?user-select??

??????

??CSS??ν??????????????????

user-select

???????????????????????????????????С?

??

?????????????????????????????????????????????δ????????Щkey??
user-select:all :  ???????????????????
??????????????????????Html????μ?Ч????

 h2 {
        user-select: all;
      }

      code {
        user-select: all;
        width: 500px;
        display: block;
        padding: 10px;
        color: #31808c;
        background-color: #f5f4ef;
      }

      div {
        user-select: all;
      }

  <h2>????????</h2>
    <pre>
        <code>
        const num = 1;

        const result = (function () {
          delete num;
          return num;
        })();
        
        console.log(result);
        </code>
    </pre>
    <p>
      const num = 1; const result = (function () { delete num; return num; })();
      console.log(result);
    </p>

??CSS??ν??????????????????

????all?????????????????ε?????????趨??all????????????в????????

??????

????????е????????????user-select: none; ??????????????

???????

??????????????????????????????????????????????????????????????????У????????????????????

??CSS??ν??????????????????

???????????????????????????????????е?????????html??????????????sup,?????????????????????????

<p>??????и????<sup>1</sup>??????н??</p>

?????????????????????????и????1??????н?????????????????????
????????????????????,???????????????????p?????user-select:all?????????????????

sup {
  -webkit-user-select: none;
  user-select: none;
}

??CSS??ν??????????????????

???????????????

CSS????::selection`α???????????????????
???????????λ::selectionα?????????????????????????????????????????????????

color
background-color
cursor
caret-color
outline and its longhands
text-decoration and its associated properties
text-emphasis-color (en-US)
text-shadow

????

p::selection {
  color: #fffaa5;
  background-color: #f38630;
  text-shadow: 2px 2px #31808c;
}

??к??Ч?????£?

 ??CSS??ν??????????????????

????????????CSS??ν????????????????????????????????,???????CSS?????????????????????????????????????????????????????£?????????????????????


上一篇:CSS实现单选折叠菜单功能下一篇:CSS实现切角+边框+投影+内容背景色渐变效果
程序园_程序员的世界 Copyright © 2020- www.580doc.com. Some Rights Reserved.