Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refer back to a style

Status
Not open for further replies.

russellr

Programmer
Sep 11, 2001
7
AU
Here's what I want to do:
.mystyle { color: white }
blah blah blah
.someotherstyle { mystyle }

Put simply, once I've defined a style, I want to use that definition to define other styles.

I can't find any way to do this, after an hour of searching the web

Please help.
 
I don't understand what you want to reach with that but you can combine to styles in a class like:

<A href=&quot;balabla&quot; class=&quot;mystyle.someotherstyle&quot; >
Erik
 
Thanks for the replies.

What I'm trying to do with the CSS is to create a simple &quot;variable&quot; which I can then refer to.

For example, I want to say that my background color is white in one place:

Code:
.bgnd { background: white }

then I want to refer to this information in several other places, for example:

Code:
.otherstyle { refer: bgnd; color: black }

So, if I ever want to change the background color, I only have to do it in one place, namely in the definition of &quot;bgnd&quot;.

This is typical programming stuff, and I can't believe there's not a way to do this in CSS.

Pseudo-selectors etc, seem to be about something else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top