variables within css?

liunx

Guest
Can style sheets accept variables?
I wanted to change the following using variables but doesnt seem to work for frames...

body { margin: 0; overflow: hidden;}
#top { height: 15%; width: 100%; overflow: hidden; border: 0;}
#bottom { height: 85%; width: 100%; overflow: auto; border: 0;}

using variable1 and variable2

body { margin: 0; overflow: hidden;}
#top { height: variable1%; width: 100%; overflow: hidden; border: 0;}
#bottom { height: variable2%; width: 100%; overflow: auto; border: 0;}Only in IE using expression (<!-- m --><a class="postlink" href="http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp">http://msdn.microsoft.com/workshop/auth ... recalc.asp</a><!-- m -->)Although I don't see why you'd want to, it could be easily achived server-side.

Very very simple PHP script:<?php
header('content-type:text/css; charset=iso-8859-1');
header('Pragma: no-cache');

echo <<< STYLE

body{
background: #{$back};
color: #{$forth};
}

STYLE;

?>Not with CSS but XHTML does support creating your own entities. So you couldn't do that with an external style sheet.
 
Back
Top