Inheritance, variables and CSS

Giganews Newsgroups
Subject: Inheritance, variables and CSS
Posted by:  Giggle Girl (missgig…@gmail.com)
Date: 31 Jan 2006

I have inherited a stylesheet that has many of the same values over and
over.  Can you use a variable in CSS so I only have to hardcode a
border color once, for instance?

Here is a snip from the current sheet:

    .outlook_borderRight1
    {
     border-right: #ff9900 solid 2px;
    }

    .outlook_borderBottom1
    {
     border-bottom: #ff9900 solid 2px;
    }

    .outlook_borderIFrame
    {
     border-top: #ff9900 solid 2px;
     border-left: #ff9900 solid 2px;
     border-right: #ff9900 solid 2px;
    }

Since "ff9900" is used over and over, can I just set it once somewhere?
  Like

var BORDER_Tabulated_Result : #ff9900;

    .outlook_borderBottom1
    {
     border-bottom: BORDER_Tabulated_Result solid 2px;
    }

I know my syntax is wrong, but you (hope, hope) get the idea.

Can using "variables" be done?

Thanks,
Ann
PS: I am a backend programmer, who is new to CSS.

Replies