浏览网页的时候,会遇到某些想要复制的文字不能选中

我们如果想要实现这个效果,只需要对包含这部分文字的标签设置一个css属性

user-select:none

但是低版本的IE浏览器无效,想要实现这个效果,可以用标签属性onselectstart="return false;"来实现

    <div class="test">
        我是你得不到的
    </div>
 .test {
            user-select: none
        }

这样写,页面显示的文字内容就无法选中了

为了使用多个浏览器,可以这样写,但是IE还要通过行内属性来实现

  .test {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

 

相关文章:

  • 2021-11-02
  • 2021-04-07
  • 2021-12-22
  • 2021-11-10
  • 2021-11-02
  • 2021-12-06
  • 2021-11-22
  • 2021-09-23
猜你喜欢
  • 2021-12-20
  • 2021-12-15
  • 2021-11-21
  • 2021-09-12
  • 2021-04-29
  • 2021-12-23
  • 2021-12-29
相关资源
相似解决方案