VOOZH about

URL: https://www.geeksforgeeks.org/css/cssstyledeclaration-csstext-property/

⇱ CSS StyleDeclaration cssText Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

CSS StyleDeclaration cssText Property

Last Updated : 9 Jun, 2023

The cssText property is used to set or return the value of an inline style declaration of an element

Syntax:

  • It is used to return the cssText property.
element.style.cssText
  • It is also used to set the cssText property.
element.style.cssText = style

Property value:

  • style: It is a string literal that specifies the style to be added to the element.

Return Value: It returns the inline style of the element in the form of string. 

Example 1: To get the cssText property

Output:

👁 Image
 

Example 2: To set the cssText property

Output:

👁 Image
 

Supported Browsers: The browsers supported by CSS StyleDeclaration cssText Property are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 5
  • Firefox 1
  • Opera 12.1
  • Safari 1
Comment