View Full Version : [CSS] Directly Accessing a Selector Inside a Class

09-30-2004, 07:15 PM
I've done searches here for this and couldn't find anything. :( I may not have the correct teminology, but I know nothing about CSS.

Here's a piece of a style sheet I have:

.alt1, .alt1Active
background-color: #F5F5FF;
color: #000000;

What I want to do is effectively "dereference" the colors inside this class and use them directly.

In the following piece of html

<img width=166 height=77 src='http://www.weatherroom.com/cgi-bin/weather.cgi?forecast=hourly&hwvtc=black&hwvbg="alt1"&pands=Huntsville, AL&config=png&alt=hwicc' alt="Weather for Huntsville,AL provided by weatherroom.com." border="0">

"hwvbg=" is currently hard coded. I want to use the "background-color:" selector's color element in the html instead of hard coding. The current implementation of "alt1" uses the "color" element. Is there a way to specify which selector to use within a class?

Thank you for your assistance.

09-30-2004, 11:44 PM
I have no idea what I'm looking at or what you're trying to achieve. Put double-quotes around all attribute values. URL's, like that in the src attribute, should have entities like ampersands(&) and double-quotes (") encoded (&amp; for &, %22 for ").

If you want to apply those styles to an element, you need to add
class="alt1" to the element.

10-01-2004, 01:05 AM
Thank you for your reply. I know by using the class="alt1" I can make the element take on the properties of that class, but the problem is that I want to pass those values on to an external cgi script which returns a graphic to me.

Here's the bigger picture. I'm using the vbulletin forum system (the same one this site uses). vB has the capability to have different "styles" which can give the site a different look. These styles are user selectable and store a lot of their color information in an inline CSS.

The weather module which I have created, uses a cgi script (http://www.weatherroom.com/add.html) on www.weatherroom.com to get the current weather. Two of the parameters the cgi script calls for is background and text color, which currently are hard coded into the html (&hwvtc=black&hwvbg="alt1"). (Black is the one for text color, the other is the background. They accept standard html colors or hex code f5f6f5, etc.).

The problem is when I choose a different style using a completely different color scheme, the weather module still has the same colors since it is hard coded. This looks funny and not integrated. What I want to be able to do is pull the proper color information from the CSS, since it changes with the style appropriately, and send that color information to the cgi script. I hope that makes some sense. Any help appreciated.