The basic CSS Selectors supported by jQuery : css function « jQuery « JavaScript Tutorial






Selector                  Description
*                         Matches any element.
E                         Matches element with tag name E.
E F                       Matches elements with tag name F that are descendents of E.
E>F                       Matches elements with tag name F that are direct children of E.
E+F                       Matches elements F immediately preceded by sibling E.
E~F                       Matches elements F preceded by any sibling E.
E:has(F)                  Matches elements with tag name E that have at least one descendent with tag name F.
E.C                       Matches elements E with class name C. Omitting E is the same as *.C.
E#I                       Matches element E with id of I. Omitting E is the same as *#I.
E[A]                      Matches elements E with attribute A of any value.
E[A=V]                    Matches elements E with attribute A whose value is V.
E[A^=V]                   Matches elements E with attribute A whose value begins with V.
E[A$=V]                   Matches elements E with attribute A whose value ends with V.
E[A*=V]                   Matches elements E with attribute A whose value contains V.



$("p:even");                    selects all even <p> elements.
$("tr:nth-child(1)");           selects the first row of each table.
$("body > div");                selects direct <div> children of <body>.
$("a[href$=pdf]");              selects links to PDF files.
$("body > div:has(a)")          selects direct <div> children of <body>-containing links.








30.29.css function
30.29.1.Add border to DIV
30.29.2.Add paragraph and set the style
30.29.3.Define CSS in an array and set
30.29.4.Get CSS value
30.29.5.Set two CSS value in CSS function
30.29.6.Nested style setting
30.29.7.Use the rgb function with JQuery
30.29.8.Use CSS value when creating new tag
30.29.9.The basic CSS Selectors supported by jQuery
30.29.10.css(name): Return a style property on the matched element.
30.29.11.css(properties): set several style properties on matched elements.
30.29.12.css(name, value): If a number is provided, it is automatically converted into a pixel value.
30.29.13.Adds a background and text color to all the headers on the page.
30.29.14.Sets the background color of the page to black.