• 单独设置css的class属性


    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>单独设置css的class属性</title>
        <style>
            .error{
                width: 100px;
                height: 100px;
                color: red !important;
            }
        </style>
    </head>
    <body>
    
    <div class="error" id="div1" style="background:black;color:blue;">hello world</div>
    <script>
        var odiv = document.getElementById('div1');
    
        //设置单个属性
    //    odiv.style.setProperty('color', 'green', 'important');
        
        //设置整个style属性
    //    odiv.setAttribute('style', 'color:green !important');
    
    
        //http://stackoverflow.com/questions/19828515/how-to-override-css-containing-important-using-jquery
    </script>
    </body>
    </html>
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>单独设置cssclass属性</title>
    <style>
    .error{
    width:100px;
    height:100px;
    color:red !important;
    }
    </style>
    </head>
    <body>

    <div class="error" id="div1" style="background:black;color:blue;">helloworld</div>
    <script>
    var odiv = document.getElementById('div1');

    //设置单个属性
    // odiv.style.setProperty('color', 'green', 'important');

    //设置整个style属性
    // odiv.setAttribute('style', 'color:green !important');


    //http://stackoverflow.com/questions/19828515/how-to-override-css-containing-important-using-jquery
    </script>
    </body>
    </html>
  • 相关阅读:
    Excel 之查找与替换
    重拾Excel之为什么
    taobao
    祝我生日快乐
    啊哈哈哈哈!自由啦
    我是不是得了抑郁症?
    Be quiet
    tcpdump tutorial
    Java Thread 多线程同步、锁、通信
    java 堆、栈、常量池等
  • 原文地址:https://www.cnblogs.com/masita/p/5368638.html
Copyright © 2020-2023  润新知