...

View Full Version : Conditional Statements in css



512designcrew
02-12-2012, 11:01 PM
I am working on a ul css category list for wordpress and it works fine but I was curious if there is any way, pure css, that I can do something like:

if(li li == true){
li{background-image:url(some_image.png);}
}
else{
li{background-image:url(some_other_image.png);}
}

the reason I'm asking is that I want a background image to indicate if there is expandable content (such as an arrow indicator) and I want to make it conditional on there being a list embeded in another list and I would like to use css and not php or javascript. Is this possible?

ScottBaxter
02-12-2012, 11:29 PM
I am working on a ul css category list for wordpress and it works fine but I was curious if there is any way, pure css, that I can do something like:

if(li li == true){
li{background-image:url(some_image.png);}
}
else{
li{background-image:url(some_other_image.png);}
}

the reason I'm asking is that I want a background image to indicate if there is expandable content (such as an arrow indicator) and I want to make it conditional on there being a list embeded in another list and I would like to use css and not php or javascript. Is this possible?


Hi Mate,

So I can understand it a little bit better do you just want to display another arrow once the content has been expanded?

Thanks,

Scott

512designcrew
02-13-2012, 12:03 AM
I have an example here: http://www.512designcrew.com/ul_vertical.htm

what i would like to do is add bg images to indicate if there is more content to be displayed, i.e under the locations and contact categories, based on the if there is an embedded ul in that category. I hope that makes it a little clearer. Thanks.

ScottBaxter
02-13-2012, 12:06 AM
I have an example here: http://www.512designcrew.com/ul_vertical.htm

what i would like to do is add bg images to indicate if there is more content to be displayed, i.e under the locations and contact categories, based on the if there is an embedded ul in that category. I hope that makes it a little clearer. Thanks.

Ok I think I'm getting there do you mean, if for instance you have following navigation:

Home
Services
Products
Contact

And under the products heading you had

Football
Golf
Rugby
Cricket

If one of the above sub categories had another category you would want an right arrow to illustrate there is more?

Hope this makes sense?

Thanks,

Scott

512designcrew
02-13-2012, 12:11 AM
exactly, can I do this with pure css? Or do I need to write out some code?

ScottBaxter
02-13-2012, 12:15 AM
exactly, can I do this with pure css? Or do I need to write out some code?

No you can do this in pure css you would have to use a pretty complex css navigation but you would be able to pull it off...

i'll try and look for an example for you.

Thanks,

Scott

512designcrew
02-13-2012, 12:17 AM
Thanks. You've been really helpful.

ScottBaxter
02-13-2012, 12:19 AM
Your probably best to start off with something like this:

http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html

P.S thank my posy ;-)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum