CSS question
- Started
- Last post
- 6 Responses
- Skylark
aiight, time for another question about css from me...
I got a link in a cell, and when i move the pointer over the cell the whole cell change color, but I also have a hover funtion on the acctually link. offcourse it all looks good when I hover the link, but when I hover the cell it dont change the link, so I'm wondering, that if there is anyway to make the cell hover, hover the link at the same time as well?
I hope someone understands what I mean...I lack in explanation skills ;)
- whiteSneaks0
i don't think you can do that in the fashion you are going about it. you can change the background of the link but not bg of the cell and link at the same time.
another note, I don't think hovers work on anything but links in IE. you can work around that ie bug with a little javascript if you like.
- monNom0
hovers work in all browsers except NS 4.x (to my knowledge)
set your links with the attribute:
display: block;
now the box around the link becomes clickable... play with the
padding a bit to get the results you want.
- sparker0
if it is a menu item or navigational link, you might want to consider using lists to create the menu, instead of tables.
but that is optional, correct, but optional.
anyway...
monNom is right. you want to set the anchor rule to 'display:block'
include padding on the a element, not the cell.
and hover works in all browsers, just not backgrounds.
there is no need for a hack or javascript intervention here. it can be done properly with xhtml and css alone.
[code]
a {
display: block;
background-color: #'xxx';
padding: 'y'px
... rest of your css rules ...
}a:hover {
display: block;
background-color: #'xxx';
padding: 'y'px
... rest of your css rules ...
}css and tables don't always mix...tables are not for layout/design purposes.
please consider using lists for navigational items and menus.
- Skylark0
OK...I out display block, and it work fine in both netscape and ie on a pc, but on the imac i hvae it shows a big black box around all the links...???
- Skylark0
bump
- ********0
i did it here:
see on the right.
Zeldman has a good tutorial on it somewhere on his site.
I never used it within a table cell though, i recommend you to work with DIV's.
DIV's are jsut so much more hip these days!
:o)