zoukankan      html  css  js  c++  java
  • 单独设置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>
  • 相关阅读:
    sql语句的优化分析
    log4net.config
    redis lua 脚本实例
    Lua 脚本
    ServiceStack.Redis之IRedisClient<第三篇>
    有关Redis的Add和Set方法的比较
    如何在自己网站加上视频直播功能(搭建视频直播网站)
    带进度条的上传插件
    YII获取当前URL
    MYSQL常用命令
  • 原文地址:https://www.cnblogs.com/masita/p/5368638.html
Copyright © 2011-2022 走看看