The good news is that the jQuery selection syntax uses a model very similar to that of CSS.
$("body")... // jQuery code here
$("#menu")... // jQuery code here
These selectors work with descendant selectors as well:
// these two lines of code accomplish more or less the same thing, // the first is a little more specific $("#topmenu ul li a").css("backgroundColor","black"); $("#topmenu a").css("backgroundColor","black");
The jQuery css() method is very useful! It conviniently wrappers the cross-browser incompatibilities between the two models for access of css within the rival browsers and so presents us with a universally compatible way of accessing information contained in <script> tags and external stylesheets.
Have a read through the css() method documentation.
Here is an example:
Remember that CSS attribute names are no longer hyphenated as they are in strict CSS notation. Instead they are presented in Camel-case. So, the CSS attribute:
Note the lack of space between "font" and "Family" and that "Family" has an uppercase F.
Now open the jQuery selectors exercise page and work through it.