W3C home > Mailing lists > Public > www-smil@w3.org > April to June 2001

Style in SMIL

From: Kari Pihkala <kpihkala@cc.hut.fi>
Date: Wed, 23 May 101 16:11:52 +0200 (EET DST)
Message-Id: <200105231311.QAA10467@alpha.hut.fi>
To: www-smil@w3.org

Hello,

I got a question about styles in SMIL after staring at standard 
Courier 10 black on white font in the text elements. It would be nice 
to format text using CSS2. However, none of the SMIL elements have 
the style attribute. It would be nice to know why? 

I know there are alternative ways to do this, one is to use external 
stylesheets in the beginning of the XML document:

<?xml-stylesheet href="style.css" type="text/css"?>

However, I consider this limiting, especially for scripting. 
Frequently, the color of the text is wanted to be changed when mouse 
is over it. But, the above stylesheet can't be modified from the script 
and prevents changing the color.

One solution is to use the <layout type="text/css"> element.
The regions will then be defined using CSS2, which includes text 
formatting, for example:

[region="b"] { top: 20px; left: 10px; font-family: Arial; color: blue; }
[region="r"] { top: 20px; left: 10px; font-family: Arial; color: red; }

The script would then change the region of the text element from 'b' to 'r'.
<text region="b" ... > becomes
<text region="r" ... >

Another way is to use CSS2 classes:

[region="area"] { top: 20px; left: 10px; }
.red  { color: red; }
.blue { color: blue; }

The script would then change the class attribute of the text element 
from 'red' to 'blue'.
<text class="red" region="area" ... > becomes
<text class="blue" region="area" ... >

But I find this a bit cumbersome. The way it would be done in HTML is:

<text region="area" style="color: red;">

and the style attribute would then be changed using the script. 
I understand this may produce some problems. The region of the media 
element could be defined using the style attribute:

<text region="area" style="top: 10px; left: 20px">

and this is probably something unwanted. (or is it?)

It would be nice to hear opinions about this. Is there a reason not to 
have the style attribute?
SVG and XHTML have it. They also have a style element.

 - Kari
Received on Wednesday, 23 May 2001 09:12:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:34:23 UTC