a question about a page i use css with

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

a question about a page i use css with

Post by dull1554 »

i'm trying to code a php menu system, i wanted to use css to make the table cells change color on hover, heres what i have

Code: Select all

#MAINMENU {
	BACKGROUND-COLOR	: #808080;
}
#SECONDARYMENU {
	BACKGROUND-COLOR	: #C0C0C0;
}
and this is what i tried but it failed horriably!!!!!!!!!

Code: Select all

#MAINMENU {
	BACKGROUND-COLOR	: #808080;
}
#MAINMENU:hover {
	BACKGROUND-COLOR	: #C0C0C0;
}
#SECONDARYMENU {
	BACKGROUND-COLOR	: #C0C0C0;
}
#SECONDARYMENU:HOVER {
	BACKGROUND-COLOR	: #808080;
}
is it just that you can't change table bgcolor on:hover?

is there a different way of doing this?????
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

The only browser that supports td:hover currently is Mozilla.

If you want some nice css examples to work from, check this out.

http://css.maxdesign.com.au/listamatic/
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

thanks
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

is there any way in which i could create some sort of a element inside my <td> that i could pass the hover thingy(for lack of better words to describe it) to so i still get a similar effect?
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

Are rollovers out of the question in your situation?
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

Using JavaScript, you can change the bg color of table cells.

But if you're only using css, you can only change the bg color of links, using a:hover.
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Yes, I've done it before with Javascript. It's pretty easy, just customize this example:

Heres an example:

Code: Select all

<td bgcolor="#808080" onMouseOver="style.backgroundColor='#C0C0C0'; style.cursor='hand'" onMouseOut="style.backgroundColor='#808080';" width="150">
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

paddy you mean a rollover image? i could do that but i want to keep it as fast as possiable, and images slow page load......., how might one do it with js, js i dont have a clue about
Paddy
Forum Contributor
Posts: 244
Joined: Wed Jun 11, 2003 8:16 pm
Location: Hobart, Tas, Aussie
Contact:

Post by Paddy »

DuFF wrote:Yes, I've done it before with Javascript. It's pretty easy, just customize this example:

Heres an example:

Code: Select all

<td bgcolor="#808080" onMouseOver="style.backgroundColor='#C0C0C0'; style.cursor='hand'" onMouseOut="style.backgroundColor='#808080';" width="150">
That one just went in my code snippet file.

Cheers Duff. :)
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

sorry duff poster just before i so i did not see his post, thanks, i got it, i went out on my own and i'm using this

Code: Select all

<td onMouseover="this.bgColor='#CFCFCF'"onMouseout="this.bgColor='transparent'">
Post Reply