Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / January 2008



Tip: Looking for answers? Try searching our database.

Pseudo-classes in Inline Styles

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mail4dag@yahoo.com - 31 Jan 2008 19:12 GMT
I would like to be able to change the background-image of a <div>
based on the :active pseudo-class, but I want to do it on a per <div>
basis. It is possible to set up a class to do it for all <div>s of a
class with:

div.imagediv{
  background-image: url(image.png);
  background-repeat: repeat-x;
}

div.imagediv:active {
  background-image: url(activeimage.png);
}

But this only allows for all images of a class to have the same
background image. The <div>s will be of different sizes, so each of
them will need a difference background image, but I also want time to
have a different active image. I found a syntax reference on the
w3.org website (http://www.w3.org/TR/2000/WD-css-style-attr-20001025)
under "3. Cascading Order" where it has inline pseudo-classes, but I
can't seem to get it to work (I don't know if browsers implement it).
What I would like is something along the lines of:

<div style="{background-image: url(image.png); background-repeat:
repeat-x;}
                :active {background-image:
url(activeimage.png); }>...</div>

This is patterned after the link above, but does not change the
background-image when the <div> is clicked. Is this possible? Does
anyone know how to do it? Is there a different way I might be able to
get it to work without having a different class for each <div> height?

Thanks,

Don
Ben C - 31 Jan 2008 22:26 GMT
> I would like to be able to change the background-image of a <div>
> based on the :active pseudo-class, but I want to do it on a per <div>
[quoted text clipped - 17 lines]
> under "3. Cascading Order" where it has inline pseudo-classes, but I
> can't seem to get it to work (I don't know if browsers implement it).

I don't think they do. That's quite an old CSS2 draft you've found. I've
never heard of this syntax before (I only got involved with this whole
business from CSS 2.1).

> What I would like is something along the lines of:
>
[quoted text clipped - 7 lines]
> anyone know how to do it? Is there a different way I might be able to
> get it to work without having a different class for each <div> height?

I think you will have to just have a different class.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.