Jump to content

I cannot get css :hover to work


Go to solution Solved by DarkKnight2011,

Recommended Posts

  I really cannot understand it, I've tried several different ways of writing it that I'm sure I've used before, and I simply cannot get :hover to work with any of my divs...

 

html:

<a href=''><div id='menu' class='button1'></div></a>
<a href=''><div id='menu' class='button2'></div></a>
<a href=''><div id='menu' class='button3'></div></a>
<a href=''><div id='menu' class='button4'></div></a>

css:

	#menu {
	width:75px;
	height:75px;
	background-color:red;
/*	background-image:url('menu.jpg');  */
	float:left;
	margin:20px;
	}
	
	.button1:hover {
/*	background-position:75px 75px;  */
	background-color:yellow;
	}

as you can see I've commented out the image, ultimately I want the image to appear, but for now I can't get the :hover to change the state of the div at all, no reaction...

 

any help would be much appreciated, its really frustrating me...

Link to comment
https://forums.phpfreaks.com/topic/277744-i-cannot-get-css-hover-to-work/
Share on other sites

  • Solution

As far as I know, you cannot use the same id more than once, that could be throwing an error an causing your issue,

 

they could all have the class menu, and the id's can be button1, button2 etc

Edited by DarkKnight2011
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.