View Full Version : CSS hover without links
ashleypower
04-17-2003, 02:07 PM
Can you use 'hover' with out being a link?
What I mean is, can I have text change it's original state even if it's not a link, using 'hover'?
redhead
04-17-2003, 02:16 PM
you sure can. using whateverElement:hover... the only thing is... its not supported by Internet Explorer... *applauds microsoft*
ashleypower
04-17-2003, 02:21 PM
Ugh...is it possible with javascript?
ronaldb66
04-17-2003, 02:28 PM
As far as I can remember (afaicr?) the same browsers that don't support :hover on any other element then a don't support the necessary javascript properties either (or DOM, wherever the pain is), which makes sense, in a way.
ashleypower
04-17-2003, 02:30 PM
Any suggestions on how I might accomplish this?
redhead
04-17-2003, 02:48 PM
Originally posted by ronaldb66
As far as I can remember (afaicr?) the same browsers that don't support :hover on any other element then a don't support the necessary javascript properties either (or DOM, wherever the pain is), which makes sense, in a way. you are mostly right...
try this though:
<style>
div.hoverme, div.off {
background-color: #B4B4B4;
}
div.hoverme:hover, div.on {
background-color: #FFFF44;
}
</style>
<div class="hoverme">using :hover</div>
<div class="off" onmouseover="this.className='on';" onmouseout="this.className='off';">Changing class with javascript</div>
IE will only make the one changing using javascript work, but most (all?) other browsers will work with both...
hope that helps, without going too offtopic :eek:...
ashleypower
04-17-2003, 03:12 PM
That is PERFECT! Haha, thanks alot dude.
redhead
04-17-2003, 03:17 PM
:) any time
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.