The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Which is best to use, li:hover or js mouse_over Reply To: Which is best to use, li:hover or js mouse_over


It’s something about anything that even looks JS function-like in code or text that’s flagging it up.

Firstly, as I said, not having text in a link is a big accessibility no-no so you should have something but it can be easily hidden and there are multiple techniques.

The images are there for styling only so they should be in the CSS as a background images on each state (hovered or unhovered).

Which is best for download time

No difference…the images would (I think) be downloaded anyway (or if not, only when called) whether by CSS or JS.

If the images would be used multiple times (perhaps for multiple links) then maintainability would be on the side of CSS as you would only have to change the CSS once if you decided to change the image..whereas you would have to change it in the HTML on every page manually in the JS solution (unless the pages are created by server side code).

I see no real need to use JS to do something that CSS can do…and if JS is required it should be abstracted out into a separate JS file and not handled inline (IMO).