IMG rollover is CSS?
- Started
- Last post
- 16 Responses
- bhawk
Is there a way to make an img rollover using CSS, like the text rollover? Or I'm just dreaming. So what ever link I place on an img it will have it's attribute assigned to it by the CSS?
- Nairn0
If you're doing that thing with 2 colour transparent gifs, you can, yeah - but otherwise? i don't think so.
- bhawk0
hmm... :(
- unknown0
yes - using the "hover" pseudo-class in CSS2 to change the background url
- kpl0
hmm...
try positioning one image above another using div and absolute positioning. For the image on top, create a :hover class for it, with display: none.never tried it before, worth a shot I suppose.
- mitsu0
that or switch their z-index if you are doing more of a layering effect
- enobrev0
No way with an img tag, but it's possible using anchor tags.
look at the source of this for an example:
http://www.enobrev.com/rollover.…
Zeldman explains the how/why in his book. It's also how he loads his banners at http://www.zeldman.com/
- enobrev0
sorry.. didn't mean "no way", but actaully now way without workarounds that may be browser dependant.
- paulsmith0
I am doing it on my site: http://www.smithpaul.com the top icons are CSS rollovers with CSS preloader's too.
- atomica0
Paul those act kinda glitchy in ie6 win xp, they blank out between the switch a lot.... why not just do the old fashioned jscript way anyhow?
- muidlatif0
whoa.. paul... your site is neat and clean (tsg/code). Can;t believe what CSS can do nowadays. It works faster and you don't need to see how messy the code looks like. :P
Thanks.
- jevad0
yeah - real nice job paul - works fine on my IE6 winXP
- paulsmith0
Thanks Chaps! CSS is definatly the way to go theses days.
Netscape 4 (may it roast in hell) is being used less and less to the point of insignificance, which opens the door for a move to CSS/XHTML based sites instead old fashioned hybrid table based layouts.
- jevad0
amen brother paul!
jsut got finished reading zeldmans new book - and halfway through eric meyers one.
need to get to grips asap cos I want my new portfolio to be strict xhtml/css
- unknown0
paul smith - your site doesn't validate :-/
- Blofeldt0
hmmm, interesting, Paul your rollovers look a bit flickery and unreliable on my PC, Win 2000, IE6. Also, if you're after total compliancy, you should alter your style sheet so as your site will conform to the RNIB's accessibility guidelines.
Nice site though!
- paulsmith0
Your right my site doesn't validate but that is only for now. I am currently changing a MovableType sanitize plugin and having some problems.
My CSS and mt XHTML did validate once upon a time and something else I need to fix. ;-)