Writing SMIL
Explaining every element, attribute, and behavior within the SMIL 2.0 specification is beyond the scope of this chapter; however, what follows is a thorough introduction to the basic structures and components of SMIL.
Well-Formed Code
SMIL is an XML-based language, which means that all of its code needs to be “well formed” according to the rules of XML (see Chapter 30). When writing SMIL (or any XML application), follow these rules:
Tags are case-sensitive. For the most part, single-word elements and attributes are in all lowercase (e.g.,
<region>
,<audio>
,<switch>
). Multiple-word elements and attributes use mixed case, also called camel case (e.g.systemLanguage
,<priorityClass>
,borderColor
). It is important to stick to the capitalization structures in the specification.All attribute values must be contained in double quotation marks.
All tags must be closed. For container tags, the closing tag must be present (e.g.,
<
tagname
>...</
tagname
>
). Empty tags (standalone elements that don’t have closing tags, such as<img>
and<br>
in HTML) are closed by the addition of a slash at the end of the tag (e.g.,<
emptytag
/>
).Nested elements must not overlap (e.g.,
<switch><par></par></switch>
, not<switch><par></switch></par>
).
Document Structure
Like HTML documents, SMIL documents are made up
of a head element and body element. The head element contains
information about the document, including layout instructions (using
the <layout>
,
<meta>
, and
<metadata>
elements). ...
Get Web Design in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.