Re: css with attribues

Brad Kemper:
> It sounds to me like what he is saying is that CSS properties (at  
> least those appropriate for all media) should be assignable  
> directly to to HTML tags as attributes,

SVG kind of does this. I believe it is a bad idea, but it is up to  
the markup language anyhow, so www-style is probably the wrong list  
for this.

> so that the following would be equivalent (assuming only one div in  
> this example):
>
> <div float="left" width="20em">
> div { float:left; width:20em; }

One problem -- besides the fact that presentational attributes have  
little to no place in a semantic markup language -- is that several  
CSS property names are already taken as attribute names in HTML using  
(slightly) different values (e.g. |width| has dimensionless pixels),  
often varying among element types.

> With that, the "style" attribute would be redundant.

OTOH one actually could make a CSS module or separate specification  
that referenced most CSS modules (except Syntax, Selectors, Media  
Queries ...). Providing XML-compatible attribute syntax and an  
assigned namespace you could use inline styling in any dialect of  
XML, without the need to introduce a |style|-like attribute. There  
wouldn't be much cascading or stylesheets, though.

   <html xmlns="http://www.w3.org/1999/xhtml" xmlns:css="http:// 
www.w3.org/2008/css">
   <div css:float="left" css:width="20em">

PS: Perhaps XML should have allowed multiple default namespaces,  
where the author would have been responsible for making sure there  
were no ambiguities or there would have been a rule for taking  
precedence, but XML prefers clear distinction over human readability.

Received on Tuesday, 15 January 2008 17:44:24 UTC