Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-09-2012, 02:30 PM   PM User | #1
MrBiggZ
Regular Coder

 
MrBiggZ's Avatar
 
Join Date: Apr 2005
Location: Indianapolis IN
Posts: 237
Thanks: 34
Thanked 0 Times in 0 Posts
MrBiggZ is an unknown quantity at this point
Need help with CSS menu when hovered over

Greetings!

I need a little push here! I'm trying to do this css based menu which seems all to simple but I've hit that proverbial mental road block!

I haven't written any code for it yet for the simple fact that I really don't know where to start!

What I want to do is on hover change the image to an animated image (which I already have) and perhaps change the color of the text at the same time.

This is the code I have in my head for the line item I just really don't know how to put the CSS down.

Code:
<ul id="menu">
      <li><a href="#" title=""><img src="static_soccer_ball.gif">Item #1</a></li>
</ul>
I'd rather do this in CSS than to bust out Gimp and make an image for each menu item. This makes changing the menu at any give time much easier!

I hope somebody can give me this little push! Thank so very much way in advance!
__________________
“No matter how slick the demo is in rehearsal, when you do it in front of a live audience, the probability of a flawless presentation is inversely proportional to the number of people watching, raised to the power of the amount of money involved.” ~ Mark Gibbs
MrBiggZ is offline   Reply With Quote
Old 01-09-2012, 03:19 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Good morning MrBiggZ,
You could do this the same way you build a normal sprite rollover but with seperate images. It would have a hesitation between it's normal and hover states though, that's why we use sprites.
Maybe find an image preloader to go along with this.

Start with something like this maybe -
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
	margin: 0;
	background: #fc6;
}
#container {
	width: 800px;
	margin: 30px auto;
	background: #999;
	overflow: auto;
}
#menu {
	height: 35px;
	width: 600px;
	margin: 0 auto;
	padding: 0;
	background: #99CCCC;
	list-style: none;
}
	#rollover1 {
		line-height: 35px;
		width: 100px;
		float: left;
		text-align: center;
	}
		#rollover1 a:link,
		#rollover1 a:visited {
			height: 30px;
			width: 100px;
			display: block;
			background: url(static_soccer_ball.gif);
		}
		#rollover1 a:hover,
		#rollover1 a:active {
			background: url(hovered_soccer_ball.gif);
			color: #f00;
		}
</style>
</head>
<body>
    <div id="container">
        <ul id="menu">
        	<li id="rollover1"><a href="#" title="">Item #1</a></li>
        </ul>
    <!--end container--></div>
</body>
</html>
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Old 01-09-2012, 05:06 PM   PM User | #3
MrBiggZ
Regular Coder

 
MrBiggZ's Avatar
 
Join Date: Apr 2005
Location: Indianapolis IN
Posts: 237
Thanks: 34
Thanked 0 Times in 0 Posts
MrBiggZ is an unknown quantity at this point
Thank you!!!!!!!!

Very very very close to what I had in my head! The rest I can do simple enough!
__________________
“No matter how slick the demo is in rehearsal, when you do it in front of a live audience, the probability of a flawless presentation is inversely proportional to the number of people watching, raised to the power of the amount of money involved.” ~ Mark Gibbs
MrBiggZ is offline   Reply With Quote
Reply

Bookmarks

Tags
css, hover, menu

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:57 PM.


Advertisement
Log in to turn off these ads.