2022.2

Table Of Contents
css(styleName) : String
ReturnsthevalueofthespecifiedCSSpropertyofanHTMLelement,whichcanbe:
l
Thefirstelementinasetofelementsthatmatchtheselectorofascript(see"results"on
page844).
l
Oneelementthatmatchestheselectorofascriptthatrunsfor"Eachmatchedelement"(see
"this"onpage781and"Settingthescopeofascript"onpage373).
l
Thefirstelementinasetofelementsreturnedbyaqueryinthetemplate(see"query()"on
page742).
propertyName
String;thenameoftheCSSproperty.
Examples
Thisscriptstoresthetextcoloroftheresults(theHTMLelementsthatmatchtheselectorofthe
script)inavariable.
var textcolor = results.css("color");
ThefollowingscriptlooksupanelementwiththeID#calloutboxandstoresitsbackgroundcolorina
variable.
var backgroundcolor = query("#calloutbox").css("background-color");
css(styleName, value)
FunctiontosetaCSSpropertyofoneHTMLelementorofeachelementinaresultset.
propertyName
String;thenameoftheCSSproperty.
value
String;valuefortheCSSpropertyoramapofproperty-valuepairstoset.
Examples
ThisscriptlooksupanelementwiththeID#calloutboxandsetsitstextcolortored.
query("#callout p").css('color' , 'red');
Page 796