Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
CSS style.display question
Old 12-01-2008, 06:04 PM CSS style.display question
Junior Talker

Posts: 2
Name: Mike
Trades: 0
I have a vertical list of items. I'd like each one to change colors when the mouse hovers over them, like on a navbar. If the user clicks then I'd like to have new data appear below the item that was just clicked on. I was trying to do this with style.display attributes but I'm not sure if that's right (I'm new to CSS). Here's an example:

List item 1
List item 2
List item 3

When the user clicks on List item 2, new data will appear between item 2 and 3 with the result being this:

List item 1
List item 2
new data has appeared here
List item 3

If the user then clicks on List item 2 again, it will hide the new data (so clicking on List item 2 toggles the "new data" visible/invisible.

The actual list will have about 25 items in it. And it's possible to click and open more than one at a time. ie if you click on item 2 and then item 6 then the 'new data 2' and 'new data 6' will both be visible at the same time.

Can someone show me a few lines of code that will do this in a cross-browser compatible way?

Thanks!
scanlin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-02-2008, 04:05 PM Re: CSS style.display question
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
First of all, you can't do all that you want with just css - you need some javascript. All you can do with CSS is change the colors of the links. You'll need something like this to change the color on hover:

#nav li a:hover{color: red;}

If you want that color to stay red, to indicate they're on that item, you'll need to add a class to the link:

#nav li a:hover.selected{color: red;}
with <a class="selected" href.........>list2</a>
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS style.display question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25160 seconds with 12 queries