Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [CSS] Directly Accessing a Selector Inside a Class

    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:
    Code:
    .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
    Code:
    <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.

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    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
    Code:
    class="alt1"
    to the element.

  • #3
    New Coder
    Join Date
    Sep 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 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.
    Last edited by SamirDarji; 10-01-2004 at 12:09 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •