HTML and CSS Reference
In-Depth Information
All that's now required is to replicate the style elements with that class.
In most cases, you can add the selector to your original rule. But the
nth-child
syntax will cause
IE8
to treat the whole rule as invalid, so the
style rule also has to be replicated.
Using jQuery to support older browsers is a handy workaround if
there are some CSS3 styles that absolutely must be applied. In later
chapters, you'll see other JavaScript libraries that can enable CSS3
features in older browsers. These can be massive time
—
savers. But
remember, they do come at a cost—if you rely on them heavily, they can
significantly increase your page
—
loading times.
Summary
In this chapter, you've learned about many new features available in
CSS3
for selecting elements: combinators for selecting elements based
on relationships with their parents; pseudo-classes for selecting ele-
ments based on their relationships with their siblings; attribute selec-
tors that reduce your dependence on
class
and
id
attributes; and
dynamic pseudo-classes for giving immediate feedback to users on the
state of form elements. It's been a lot to get through, but these features
make up the foundation on which all the rest of
CSS
is built.
After you've picked out elements with selectors, pseudo
—
classes, and
attribute selectors, you'll want to apply styles to them. CSS3 offers many
new options in that department, and in the rest of the topic you'll learn
about them. We'll start in the next chapter with the new options for layout.