Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Unordered List Rollover Sprite Buttons
Old 08-09-2009, 01:47 AM Unordered List Rollover Sprite Buttons
Extreme Talker

Posts: 176
Trades: 0
Trying to combine so many things... isn't working out too well

Here's an example of the button image:


HTML:
HTML Code:
<ul id="buttons">
<li id="home"><a href="#"> </a></li>
</ul>
And the CSS
Code:
ul#button {
display: block;
width: 125px;
height: 43px;
list-style-type:none;
float: left;
}
ul#button a{
float: left;
width: 125px;
height: 43px;
list-style-type:none;
margin: 0;
display: block;
}
ul#button a:hover {
background-position: 0 -43;
width: 125px;
height: 43px;
}
li#home  a {
background: url('/images/buttons/home.gif');
border: solid red 1px;
}
Don't really know what I'm doing, here's the page it'self

If you can give me any insight on doing buttons/menus like this, please do.

I think this is the best way to do it, but tell me if I'm wrong.
Skeddles is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-09-2009, 03:25 AM Re: Unordered List Rollover Sprite Buttons
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
Do you realize you have ul#buttons in the html and "button" (singular) in the css?
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Old 08-09-2009, 02:44 PM Re: Unordered List Rollover Sprite Buttons
Extreme Talker

Posts: 176
Trades: 0
Quote:
Originally Posted by racer x View Post
Do you realize you have ul#buttons in the html and "button" (singular) in the css?
Haha thanks
</stupid>

So now the buttons actually show up, they just don't do anything when you hover.

And there may be some extra css code.
Skeddles is offline
Reply With Quote
View Public Profile
 
Old 08-09-2009, 04:56 PM Re: Unordered List Rollover Sprite Buttons
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Quote:
ul#button a:hover {
background-position: 0 -43;
width: 125px;
height: 43px;
}
li#home a {
background: url('/images/buttons/home.gif');
border: solid red 1px;
}
You have to do 2 things - 1: be more specific and 2: -43 won't work, -43 WHAT ? It should be -43PX. This works:

Quote:
ul#button a{
float: left;
width: 125px;
height: 43px;
margin: 0;
display: block;
}

/*#button a:hover {
background-position: 0 -43px;
width: 125px;
height: 43px;
}*/

ul#button li.home a {
background: url(home.gif);
border: solid red 1px;
}

ul#button li.home a:hover {
background-position: 0 -43px;
}
Yes, I changed your ID to a class, as there's really no need to use an ID for this unless you're targeting it with scripting.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-09-2009, 07:01 PM Re: Unordered List Rollover Sprite Buttons
Extreme Talker

Posts: 176
Trades: 0
http://eclipsediskjockeys.com/design.htm

Thank you, I got it to work. Had to also add ul#button to get rid of the list style.

Isn't there a way that I can do the hovers all in one rather than separate ones?

It'd be much neater and more convienent.

Also, I want one button floated to the left, one to the right, and the rest spaced evenly in the middle. Is this possible to do automatically or do I just have to margin them apart?


Should I change all my ids to classes/use them from now on?

Last edited by Skeddles; 08-09-2009 at 07:03 PM..
Skeddles is offline
Reply With Quote
View Public Profile
 
Old 08-09-2009, 08:39 PM Re: Unordered List Rollover Sprite Buttons
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You can get them evenly spaced floating them all in the same direction.

The problem with trying to use 1 set of rules for all hovers is that you have a different id or class on each one which affects specificity. You can group all the affected selectors on one line, separated by commas.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Unordered List Rollover Sprite Buttons
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.50587 seconds with 12 queries