Previous Message
Next Message

CSS: setting values that can be referenced within the CSS

Sent by Ben Curtis on 29 December 2004 19:07


> Is it possible within CSS to set values that can be referenced?

Lynda,

No, but you could reference multiple classes in your document, allowing 
you to "compose" a class in the document by combining elemental bits 
from the stylesheet. You would likely want to avoid embedding design 
decisions in your document, though -- so don't do this:

div.masterBGColor { background-color:#fc9; }
div.secondBGColor { background-color:#990; }
div.thinBorder { border: 1px solid black; }
div.noBorder { border:none; }
....
<div class="thinBorder masterBGColor">foo
	<div class="noBorder secondBGColor">bar</div>
</div>

....because if you do it that way then you can't change how things are 
arranged or displayed without changing the document.

Instead, you might separate layout and structural classes from 
look-and-feel classes, so that your document can combine the two:

/* layout */
div.pullQuote { position:relative; left:2em; width:20em; }
div.footer { clear:both; margin-top:3em; }

/* look-and-feel */
div.hiliteText { color:#000; font-weight:bold; font-size:1.5em; }
div.legalText { color:#666; font-weight:normal; font-size:0.75em; }
....
<div class="pullQuote hiliteText">Notice: Big Brother is watching*</div>
<div class="footer legalText">* "Big Brother" and the Big Brother logo 
are registered trademarks of the Spies"R"Us Corp.</div>


Similar to what you asked for, except embedded in the document and not 
the stylesheet.

-- 

     Ben Curtis
     WebSciences International
     http://www.websciences.org/
     v: 310 478 6648
     f: 310 235 2067





______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: