The Book of CSS3 - A Developer\'s Guide to the Future of Web Design (2nd edition)

(C. Jardin) #1

14


Tr ansiTions and animaTions


We often think of web pages as having
three layers: content (HTML), presenta-
tion (CSS), and behavior ( JavaScript), and
the general understanding is that these layers

should all be kept absolutely separate—don’t use pre-


sentational or behavioral rules in the content layer
(in other words, no CSS or JavaScript inline in the markup). This separa-
tion is not quite as clear cut as it seems, however—for a start, CSS has always
included some behavioral aspects (the :hover pseudo-class being a prime
example).
This line between presentation and behavior was blurred even further
when the WebKit developers introduced two new behavioral modules that
have been adopted as CSS3 components: Transitions and Animations. These
modules allow for the animation of element properties, adding movement
to otherwise static pages even when JavaScript is not available.
Some have argued—and perhaps still do—about whether the Transitions
and Animations Modules should be included in CSS, as they fall firmly in
the behavioral layer. But, as the W3C has decided to offer them for discus-
sion as an “official” part of CSS3, we no longer need to debate the ethics of
them—we can just have fun with them, instead!


PX

3024
Free download pdf