473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Pure CSS "div rollovers"

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

Jul 20 '05 #1
4 53961
Also sprach Kanuf <ca****@rogers.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
Jul 20 '05 #2
Tom Joyce <t.*******@dunelm.org.uk> writes:
Also sprach Kanuf <ca****@rogers.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
#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
Jul 20 '05 #3
Also sprach Chris Morris <c.********@durham.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
Jul 20 '05 #4
Tom Joyce wrote:
Also sprach Chris Morris <c.********@durham.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

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: al | last post by:
Hi, I've been trying to create a image mouseOver effect using CSS - is this possible? Or will I have to use DIV tags or something along those lines? I've tried a number of things - the code...
5
by: Thomas Hoheneder | last post by:
Hello, I have a web page that contains the following things. 1) Lots of text, so that the page is longer/higher than one browser screen. 2) Within that text there is an input text field. 3) On...
0
by: Mel | last post by:
i have about 100 topics, when the user clicks on a topic, i would like to display the content in a DIV section below the topic, using "visible" function. so far NOT BAD, i am doing it. however,...
1
by: avihaimar | last post by:
hello i have the code below: <html> <body> <table> <div id="div1" style="display :none"> <tr> <td> uuu </td>
1
by: john | last post by:
Hi to All, I am new to html authoring, so sorry if my terminology is not correct or exact. I would like to position a footer div to the bottom of the browser window. As I research in the web...
0
by: Monisha | last post by:
In my project have sub menu . When I click the sub menu option ,it displayed everything. In Main page have two drop down lists. When I was moving to upward the sub Menu, two drop down lists will...
4
by: rempit | last post by:
In 1 form..have 2 "DIV".. "DIV" one is for SEARCH.. "DIV" two is for showing the RESULT from Database of "DIV" one Button.. Everything in one page.. Anyone can help me please..
1
by: pbd22 | last post by:
Hi all. I am using styles to lock down the GUI until the user enters some info in a CSS/DIV pop box. If the user does now scroll before he clicks, the pop box is centered and the background...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.