Dynamically modifying CSS Rules

Source: Internet
Author: User

The page references two style sheets:

<link href= "css/mui.min.css" rel= "stylesheet"/>

<link href= "css/menu.css" rel= "stylesheet"/>

Get a style sheet object based on the style reference sequential index, where you get the result as a Menu.css style object

var menucss = document.stylesheets[1]; var rule;                      for (var i=0; i<menucss.cssrules.length; i++) { Rule = Menucss.cssrules[i] if(rule.type = = Cssrule.keyfram Es_rule

|| Rule.type = =Cssrule.webkit_keyframes_rule|| Rule.type = = cssrule.moz_keyframes_rule)//&& i==0{console.log (rule.csstext);  Break; }                }

for(varIteminchrule) {
Console.log (item);
}
output Style Rule object properties
Cssrules at new_touchmove.html:204
Name at new_touchmove.html:204
Parentrule at new_touchmove.html:204
Parentstylesheet at new_touchmove.html:204
Csstext at new_touchmove.html:204
Type at new_touchmove.html:204
Insertrule at new_touchmove.html:204
DeleteRule at new_touchmove.html:204
Findrule at new_touchmove.html:204
Unknown_rule at new_touchmove.html:204
Style_rule at new_touchmove.html:204
Charset_rule at new_touchmove.html:204
Import_rule at new_touchmove.html:204
Media_rule at new_touchmove.html:204
Font_face_rule at new_touchmove.html:204
Page_rule at new_touchmove.html:204
Webkit_keyframes_rule at new_touchmove.html:204
Webkit_keyframe_rule at new_touchmove.html:204
Supports_rule at new_touchmove.html:204
WEBKIT_ Filter_rule at new_touchmove.html:204
HOST_RULE At new_touchmove.html:204

Dynamically modifying CSS Rules

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.