Results 1 to 7 of 7

Thread: help!! css hover effect compatability

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    help!! css hover effect compatability

    Code:
    <style type=text/css>
    
    ul.itemmenu{
    	padding:			0;
    	margin:				0;
    
    	list-style:			none;				/*remove the bullets points*/
    	background-color: 	#FFFFFF;			/*make container background color white*/
    	width:				200px;				/*set list container to fix width*/
    	border:				1px solid;			/*make container border visible*/
    
    	font-family:		tahoma;
    	font-size: 			0.8em;
    	
    	text-align:			center;				/*makes menu align horizontally*/			
    }
    
    /*apply exclusive hyperlink list formatting to the itemmenu class.
    any hyperlink declared outside the itemmenu class
    will render unformatted*/
    
    ul.itemmenu li a{
    	text-decoration:	none;				/*remove hyperlink underline formatting*/
    	display:			block;				/*make list clickable in any list portion*/
    	width:				180px;				/*set the display block width*/
    	/*padding:			2px 10px;*/
    	/*float:left;*/
    }
    
    ul.itemmenu li a:hover{
    	background-color:	#B9BB79;			/*change hovered list background color to emphasize*/
    	border:				1px dotted;			/*and set its border to dotted lines*/
    	}
    
    ul.itemmenu li a:active{
    	font-weight:		bold;				/*make the selected link bold*/
    }
    
    </style>
    how to fix this:



    make the block line same in all browser
    Last edited by jlbantang; Oct 12th, 2007 at 08:45 AM.

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: help!! css hover effect compatability

    Reset margin and padding of the list element.
    Code:
    ul.itemmenu li { margin : 0; padding : 0; }
    As for the border, you can't get the exact same result for Firefox and IE. Firefox does dots, IE does dashes, even if you tell to do dots.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Re: help!! css hover effect compatability

    its the same hover effect after i add the li{} code.



    what i am missing? im using w3c 4 standard btw.

    Quote Originally Posted by Merri
    Reset margin and padding of the list element.
    Code:
    ul.itemmenu li { margin : 0; padding : 0; }
    As for the border, you can't get the exact same result for Firefox and IE. Firefox does dots, IE does dashes, even if you tell to do dots.

  4. #4
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: help!! css hover effect compatability

    Show also the HTML.


    Althought setting display:inline; to the li elements might also help (there is a bug related to this in IE, although it seems not to be triggered in this case; in the other hand, I don't know if we're talking about IE6 or IE7).

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Re: help!! css hover effect compatability

    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>item 1</title>
    <style type=text/css>
    
    ul.itemmenu{
    	padding:			0;
    	margin:				0;
    
    	list-style:			none;				/*remove the bullets points*/
    	background-color: 	#FFFFFF;			/*make container background color white*/
    	width:				200px;				/*set list container to fix width*/
    	border:				1px solid;			/*make container border visible*/
    
    	font-family:		tahoma;
    	font-size: 			0.8em;
    	
    	text-align:			center;				/*makes menu align horizontally*/			
    }
    
    /*apply exclusive hyperlink list formatting to the itemmenu class.
    any hyperlink declared outside the itemmenu class
    will render unformatted*/
    
    ul.itemmenu li { margin : 0; padding : 0; }
    
    ul.itemmenu li a{
    	text-decoration:	none;				/*remove hyperlink underline formatting*/
    	display:			block;				/*make list clickable in any list portion*/
    	width:				180px;				/*set the display block width*/
    	/*padding:			2px 10px;*/
    	/*float:left;*/
    }
    
    ul.itemmenu li a:hover{
    	background-color:	#B9BB79;			/*change hovered list background color to emphasize*/
    	border:				1px dotted;			/*and set its border to dotted lines*/
    	}
    
    ul.itemmenu li a:active{
    	font-weight:		bold;				/*make the selected link bold*/
    }
    
    </style>
    </head>
    
    <body bgcolor=#C0C0C0>
    
    <ul class="itemmenu">
    	<li ><a href=# onclick="alert('item 1')">item 1</a></li>
    	<li><a href=# onclick="alert('item 2')">item 2</a></li>
    	<li><a href=# onclick="alert('item 3')">item 3</a></li>
    	<li><a href=# onclick="alert('item 4')">item 4</a></li>
    
    </ul>
    
    </body>
    
    </html>
    
    
    im using IE7 and FF2

    THANKS!

  6. #6
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: help!! css hover effect compatability

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html><head>
    	<meta http-equiv="Content-Language" content="en-us">
    	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    	<title>item 1</title>
    	<style type=text/css>
    
    body { background : #C0C0C0; }
    
    ul.itemmenu{
    	padding:			10px 0;
    	margin:				0;
    
    	list-style:			none;				/*remove the bullets points*/
    	background-color: 	#FFFFFF;			/*make container background color white*/
    	width:				200px;				/*set list container to fix width*/
    	border:				1px solid;			/*make container border visible*/
    
    	font-family:		tahoma;
    	font-size: 			0.8em;
    	
    	text-align:			center;				/*makes menu align horizontally*/			
    }
    
    /*make list item an inline element and remove margin and padding*/
    ul.itemmenu li { display : inline; margin : 0; padding : 0; }
    
    /*apply exclusive hyperlink list formatting to the itemmenu class.
    any hyperlink declared outside the itemmenu class
    will render unformatted*/
    
    ul.itemmenu li a{
    	border:				1px dotted #FFFFFF;	/*and set its border to dotted lines (hide with white color) */
    	text-decoration:	none;				/*remove hyperlink underline formatting*/
    	display:			block;				/*make list clickable in any list portion*/
    	margin:				0 10px;
    	width:				180px;				/*set the display block width*/
    }
    
    ul.itemmenu li a:hover{
    	background-color:	#B9BB79;			/*change hovered list background color to emphasize*/
    	border-color:		#000000;			/*show the border by changing border's color*/
    	}
    
    ul.itemmenu li a:active{
    	font-weight:		bold;				/*make the selected link bold*/
    }
    
    	</style>
    </head><body>
    	<ul class="itemmenu">
    		<li><a href="" onclick="alert('item 1');return false">item 1</a></li>
    		<li><a href="" onclick="alert('item 2');return false">item 2</a></li>
    		<li><a href="" onclick="alert('item 3');return false">item 3</a></li>
    		<li><a href="" onclick="alert('item 4');return false">item 4</a></li>
    	</ul>
    </body></html>
    Humm, and it was some earlier version of IE that didn't show dotted correctly. You had an error in the border code as you didn't have all the required styles. I fixed the page bouncing problem when hovering links.

    I changed the list to look like what I assumed you were after. It now looks the same in Firefox, IE, Opera and Safari.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Re: help!! css hover effect compatability

    that was outstanding! keep it up!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width