473,396 Members | 1,827 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,396 software developers and data experts.

:hover not working

I have a CSS file that contains a hover element, and it is not working in ANY browser (FF3.5, IE6, GC1, SF3 O9)
Expand|Select|Wrap|Line Numbers
  1. .controls
  2. {
  3. position: absolute;
  4. right: 1px;
  5. top: 2px;
  6. height: 15px;
  7. width: 15px;
  8. background: url('JSi/closeO.png');
  9. }
  10. .controls:hover
  11. {
  12. background: url('JSi/close.png');
  13. }
Sep 25 '09 #1
8 12022
Oops, forgot the page:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.     <head>
  3.         <style>
  4.         .controls
  5.         {
  6.             position: absolute;
  7.             right: 1px;
  8.             top: 2px;
  9.             height: 15px;
  10.             width: 15px;
  11.             background-image: url('close.png');
  12.         }
  13.         .controls :hover
  14.         {
  15.             background-image: url('close2.png');
  16.         }
  17.         </style>
  18.     </head>
  19.     <body>
  20.         <div style="position: absolute; width: 300px; left: 100px; top: 100px;">
  21.             <div style="background-color: #0ff">
  22.                 Demo
  23.             <div class="controls"/>
  24.         </div>
  25.     </body>
  26. </html>
Sep 26 '09 #2
Dormilich
8,658 Expert Mod 8TB
I’d say your code works (except IE). you just forgot one thing, to see a change, there must be something to see first.
Sep 26 '09 #3
Well, it does not work for me.
of note, I don't know what i did, but now It works in firefox if i change the class to a id. I still need it to be a class thoug
Expand|Select|Wrap|Line Numbers
  1.   <html>
  2.        <head>
  3.        <style>
  4.      #controls
  5.      {
  6.             position: absolute;
  7.             right: 1px;
  8.             top: 2px;
  9.             height: 15px;
  10.             width: 15px;
  11.             background-image: url('http://hotmail.com/favicon.ico');
  12.         }
  13.         #controls:hover
  14.         {
  15.             background-image: url('http://google.com/favicon.ico');
  16.         }
  17.         </style>
  18.     </head>
  19.     <body>
  20.         <div style="position: absolute; width: 300px; left: 100px; top: 100px;">
  21.             <div style="background-color: #0ff">
  22.                 Demo
  23.             <div id="controls"/>
  24.         </div>
  25.     </body>
  26. </html>
Sep 26 '09 #4
Is this a browser error, or am I doing it wrong?
Sep 28 '09 #5
Dormilich
8,658 Expert Mod 8TB
you should check if <div /> has any visible area, e.g. by applying a border (or using Firebug).
Sep 29 '09 #6
ziycon
384 256MB
Instead of using:
Expand|Select|Wrap|Line Numbers
  1. .controls:hover
  2. {
  3.  background: url('JSi/close.png');
  4. }
try:
Expand|Select|Wrap|Line Numbers
  1. .controls a:hover
  2. {
  3.  background: url('JSi/close.png');
  4. }
Also you want to make sure all your DIVs have a closing tag.
Sep 29 '09 #7
Dormilich
8,658 Expert Mod 8TB
@ziycon
if you’re using real XHTML, you’re prompted with an error, if they don’t. HTML will auto-close such elements.
Sep 29 '09 #8
drhowarddrfine
7,435 Expert 4TB
Using <div /> is not valid in HTML and may be interpreted differently in browsers, if at all. That works in XHTML and XML but don't use it in HTML.
Sep 30 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Cezar | last post by:
Hello. How can simple emulating in IE this class ? ..example:hover{ border: 1px solid #696969; } Greets, Cezar.
2
by: skipc | last post by:
I posted a recent message regarding navigating a table using arrow keys. I've got the code for the navigation working. My table contains rows of links (anchors). I can get to a specific link...
24
by: fehays | last post by:
Hello, I'm having a problem with the css hover effect in IE. I have an <a> tag with the following CSS: a.subNavItem { display:block; color:#464645; padding:2px 7px 4px 6px;...
6
by: nishac | last post by:
Can anyone suggest me how to make my drop down menu work in IE7 too.Its working in other browsers.On mouse over the submenus should be displayed.Am attaching my css code hereby.Anyone please check...
1
by: Paul | last post by:
Below is the html and css. It works in Firefox but not IE. When you click on "Your Links", it should cause a new menu "system" to open up to the right of the "Your Links" with two menu options. ...
7
by: Cate Archer | last post by:
I want to have a border around an image that changes color when the mouse hovers over it. The following code works perfectly in FireFox but not in Internet Exploiter. The text link changes color...
4
by: Sigilaea | last post by:
My previous post got squashed because m post is too long. Sorry for that: I have an AJAX page with a CSS menu at the top. My problem is the hover functionality stops working after someone clicks...
8
by: Meri | last post by:
Hello Everybody on the internet seems to think this is a problem with IE but for me it works fine with IE, but the submenus do not appear with Firefox andOpera. The html is a simple list with...
3
by: Darren Laverick | last post by:
Hi I am trying to make dropdown menus for my website and am puzzled as to why my float left, in my container div, is not working (it is going underneath). Here is the code for both files. i hope...
0
by: Ash Mar | last post by:
Hi Every one :) My Issue is the sub menu level 2 Not working in Internet Explore but it's working perfect in all other browsers. I Spend more than 6 hours and could not find the solution guys if...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.