SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 53 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"


Let??™s demonstrate with a quick example, starting with an HTML snippet:

It's a fine morning today.


Yes. It is a fine morning.



Now, let??™s look at some CSS that could be used to style the text:
p { color:red; }
p.intro { color:blue; }
#main p { color:green; }
You might be surprised to see that the intro paragraph is green, not blue as you might
have expected. The color is green because the use of the ID selector gave that declaration a
higher importance over just the element selector and over the element with the class selector.
Therefore, to make that intro paragraph blue as you intended, you need at least one ID selector
to compete.
#main p.intro { color:blue; }
The basic rule is to figure out what level (A, B, C, or D) is forcing the specificity. Then
apply a greater specificity by increasing the current level or moving up a level. If you had a
ruleset with two class selectors, then you would need at least three class selectors or one ID
selector. If you had one ID selector and one element selector, you??™d need at least one ID selector
and one class selector, or one ID selector and two element selectors, or two ID selectors.
JavaScript Basics
Although you??™ve likely seen some of this before if you??™ve done any JavaScript programming,
I??™d like to review some of the terminology and touch on some JavaScript concepts that will be
important to understand before you get into the rest of the book.


Pages:
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
zakłady sportowe Stomatologia Wrocław ochrona środowiska Skuteczne pozycjonowanie sklep ze zdrową żywnością