zoukankan      html  css  js  c++  java
  • 获取css属性

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     5     <title></title>
     6     <style type="text/css">
     7         div.box{
     8             background-color:blue;
     9             width:100px;
    10             height:200px;
    11         }
    12     </style>
    13     <script type="text/javascript" src="test49.js"></script>
    14 </head>
    15 <body>
    16     
    17 </body>
    18 </html>
     1 var sheet = document.styleSheets[0];
     2 var rules = sheet.cssRules || sheet.rules;
     3 var rule = rules[0];
     4 console.log(rule.selectorText);
     5 console.log(rule.style.cssText);
     6 console.log(rule.style.backgroundColor);
     7 console.log(rule.style.width);
     8 console.log(rule.style.height);
     9 
    10 rule.style.backgroundColor = "red";
    11 console.log(rule.style.backgroundColor);
  • 相关阅读:
    DRF 版本和认证
    DRF 视图和路由
    DRF 序列化组件
    RESTful
    Vuex以及axios
    npm、webpack、vue-cli
    Vue 生命周期
    Vue Router
    Vue 组件
    Vue 快速入门
  • 原文地址:https://www.cnblogs.com/qzsonline/p/2501373.html
Copyright © 2011-2022 走看看