• CSS禁止选中文字


    通过CSS属性,禁止选中文字

    效果预览

    CSS

    .no-select {
    /* iOS Safari */
    -webkit-touch-callout: none;
    /* Chrome/Safari/Opera */
    -webkit-user-select: none;
    /* Konqueror */
    -khtml-user-select: none;
    /* Firefox */
    -moz-user-select: none;
    /* Internet Explorer/Edge */
    -ms-user-select: none;
    /* Non-prefixed version, currently not supported by any browser */
    user-select: none;
    }
    

    HTML测试

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>CSS禁用选中文字</title>
        <script src="http://code.jquery.com/jquery-latest.js"></script>
        <style type="text/css">
            .no-select {
                /* iOS Safari */
                -webkit-touch-callout: none;
                /* Chrome/Safari/Opera */
                -webkit-user-select: none;
                /* Konqueror */
                -khtml-user-select: none;
                /* Firefox */
                -moz-user-select: none;
                /* Internet Explorer/Edge */
                -ms-user-select: none;
                /* Non-prefixed version, currently not supported by any browser */
                user-select: none;
            }
        </style>
    </head>
    <body>
    <div style="text-align: center;top: 200px;">
        <h1>可以选择</h1>
        <h1 class="no-select">不可以选择</h1>
    </div>
    </body>
    </html>
    
  • 相关阅读:
    CMDB整体项目整理(3)
    聊聊restful和restframework
    mysql笔记(2)
    mysql笔记(1)
    cmdb整体项目梳理(2)
    DOM4J解析XML
    JAXP进行DOM和SAX解析
    XML
    CSS案例
    CSS基础总结
  • 原文地址:https://www.cnblogs.com/ast935478677/p/13331060.html
Copyright © 2020-2023  润新知