A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/css/cssom/CSSRule/cssText below:

cssText ยท WebPlatform Docs

cssText Summary

Gets or sets a textual representation of a CSS rule.

Property of css/cssom/CSSRule/CSSRulecss/cssom/CSSRule/CSSRule

Syntax
var ruleText = rule.cssText;
rule.cssText = ruleText;
Return Value

Returns an object of type StringString

Returns a textual representation of a CSS rule.

Examples
<div id="myDiv"></div>
<input type="button" value="Blue" id="blueButton">
<input type="button" value="Red" id="redButton">
<script>
    redButton.onclick=function(){
        
        myDiv.style.cssText = "background-image: radial-gradient(red,  yellow); color: darkred;"

        
        myDiv.innerHTML = "The cssText value is: " + myDiv.style.cssText;
    }
    blueButton.onclick=function(){
        
        myDiv.style.cssText = "background-image: radial-gradient(blue,  white); color: darkblue;"

        
        myDiv.innerHTML = "The cssText value is: " + myDiv.style.cssText;
    }
</script>

View live example

Related specifications
DOM Level 2 Style
Recommendation
See also Related articles CSSOM

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4