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 456 | Next

Joseph W. Lowery

"Dreamweaver CS3 Bible"

An ID
selector is identified by its beginning pound sign??”technically called an octothrope??”for example,
#footer. If you want the footer content to really stand out, you could style it with white type against a
black background with a red border. The CSS rule looks like this:
#footer {
color: #FFFFFF;
background: #000000;
border: thin solid #FF0000;
}
An ID selector is applied to a tag through the self-named id attribute, minus the pound sign. Thus, the
tag that holds the footer content is coded like this:
Footer content goes here

Designers use a combination of class and ID selectors??”as well as other types of selectors??”when laying
out the page. It??™s considered a best practice to avoid using class selectors when the CSS rule is intended to
be applied only once on the page; in those situations, an ID selector is the better choice.
TIP TIP
212
Designing and Crafting Core Pages Part II
Specificity
The specificity of a CSS rule determines which rule takes effect when two or more rules conflict. For example,
let??™s say you have one rule that sets the color of an

tag to dark gray, like this:
h1 { color: #333333; }
and another rule that sets the color of a class called .alert to bright red:
.alert { color: #FF0000; }
What would happen when the browser encounters code like this:

Attention all shoppers!


As you might suspect, the .


Pages:
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468