473,782 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 53980
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.*******@dune lm.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.********@dur ham.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.********@dur ham.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
78171
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 below will work for the border no problem, but I can't seem to get the SRC to work - is this not an option in CSS?
5
5876
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 some place after there, there is a select tag. 4) I have the following div tag absolutely positioned on the page, somewhere between all the text. <div id="fixeddiv" style="position:absolute;left:0px;top:50px;width:300px;height:100px;border:s
0
1351
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, i do not wish to load the content of 100 or more topics, since it can take a lot of time. QUESTION:-
1
1456
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
5329
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 shows this could be done a containing element with "min-height: 100%;" and an absolute positioned element (div) inside, aligned to bottom ("position: absolute; bottom:0px")
0
943
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 display in the title bar of the SubMenu . The title bar contains the title and Close(hyperlink) .The title bar is div control. Is it possible to hide the drop down lists when I moving that place ?. The drop down lists are dynamically created.
4
1373
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
3986
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 color spans the entire page. But, if he scrolls first, say, to the middle of the page, then when the click happens you only see the bottom of
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8967
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.