HighDots Forums  

Pure CSS "div rollovers"

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Pure CSS "div rollovers" in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kanuf
 
Posts: n/a

Default Pure CSS "div rollovers" - 08-07-2003 , 10:53 PM






On a page I am designing, I'm trying to create a "div rollover".
Basically, I want a div's contents to change (or a new div to replace
the old one) via hover.

I have tried this, but it doesn't seem to work.
[html]
[div id="nohover"]
TEXT and IMAGE
[/div]
[div id="hover"]
Different TEXT and IMAGE
[/div]

[CSS]
div #nohover {
position: absolute;
top: 20px;
left: 20px;
width: 70px;
height: 70px;
z-index: 10;
}
div #nohover:hover {
visibility: hidden;
}
div #hover {
visibility: hidden;
position: absolute;
top: 20px;
left: 20px;
width: 70px;
height: 70px;
z-index: 11;
}
div #hover:hover {
visibility: visible;
}

I think this doesn't work because hover doesn't pass through to the div
below. And I'm also not about to cover up the text with a bgcolor or
image, because there's some transparencies to work with. This would be a
similar effect to the simple image rollovers, but with entire divs.

I'd love to get this to work with CSS and HTML only, and I gave up
caring for compatability with MSIE a long long time ago. If it works in
Mozilla, It'd be great.

It'd be great if anyone can help,
--Kanuf


Reply With Quote
  #2  
Old   
Tom Joyce
 
Posts: n/a

Default Re: Pure CSS "div rollovers" - 08-08-2003 , 07:36 AM






Also sprach Kanuf <canwaf (AT) rogers (DOT) com>:

} On a page I am designing, I'm trying to create a "div rollover".
} Basically, I want a div's contents to change (or a new div to replace
} the old one) via hover.

Would something like:

<div id="foo>
<div id="hover">
stuff
</div>

<div id="not">
other stuff
</div>
</div>


#foo #hover {display: none;}

#foo.hover #hover {display: block;}

#foo.hover #not {display: none;}


do the trick?
--
yours aye,
Tom

You don't "watch" cricket as such, you enter a kind of meditative
state. For five days. It's very relaxing. - Tim Auton 2003-08-04

Reply With Quote
  #3  
Old   
Chris Morris
 
Posts: n/a

Default Re: Pure CSS "div rollovers" - 08-08-2003 , 08:08 AM



Tom Joyce <t.m.joyce (AT) dunelm (DOT) org.uk> writes:
Quote:
Also sprach Kanuf <canwaf (AT) rogers (DOT) com>:
} On a page I am designing, I'm trying to create a "div rollover".
} Basically, I want a div's contents to change (or a new div to replace
} the old one) via hover.

Would something like:

div id="foo
<div id="hover"
stuff
</div

<div id="not"
other stuff
</div
/div


#foo #hover {display: none;}

#foo.hover #hover {display: block;}
#foo:hover, surely

Quote:
#foo.hover #not {display: none;}
likewise

- works in Mozilla (1.4)

- doesn't work particularly well in Opera (7), on the first hover it
switches, but on unhover from then on neither is displayed,

- consistently displays #not in IE (6) and Konqueror (3).

Obviously in a non-CSS browser it just displays both.

I can see accessibility issues for this in a lot of situations, even
when it does work - combining Mozilla with a screen reader, for
instance.

--
Chris


Reply With Quote
  #4  
Old   
Tom Joyce
 
Posts: n/a

Default Re: Pure CSS "div rollovers" - 08-08-2003 , 09:47 AM



Also sprach Chris Morris <c.i.morris (AT) durham (DOT) ac.uk>:

} > #foo.hover #hover {display: block;}
}
} #foo:hover, surely


8-P

Yes, you're quite correct of course.

--
yours aye,
Tom

You don't "watch" cricket as such, you enter a kind of meditative
state. For five days. It's very relaxing. - Tim Auton 2003-08-04

Reply With Quote
  #5  
Old   
Kanuf
 
Posts: n/a

Default Re: Pure CSS "div rollovers" - 08-08-2003 , 03:11 PM



Tom Joyce wrote:
Quote:
Also sprach Chris Morris <c.i.morris (AT) durham (DOT) ac.uk>:

} > #foo.hover #hover {display: block;}
}
} #foo:hover, surely

8-P

Yes, you're quite correct of course.
Thank you for the help, it worked perfectly.

--Kanuf



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.