cgacfox — 2010-01-27T22:30:02-05:00 — #1
Ok I spent some time looking on the Internet for tutorials on horizontal menus but nothing really has what I am trying to achieve. I have a background that the buttons sit on. The buttons are all sliced (6 of them for the "up" state and 6 for the "hover/down/active" state. I need a jump start to get this going. All buttons as sliced individually....don't know if that is correct. I have my unordered list and I know that I have to make it in-line to get get it horizontal...at least I think I do. If you could explain how this is done and what is the easiest way to do this so I can reuse the code in the future.
Here is the HTML
<li><a href="#">How Can We Help?</a></li>
<li><a href="#">Design Pricing</a></li>
Here is the CSS so far...I have the nav background but am not sure where to start for the actual buttons.
luki_be — 2010-01-27T23:02:52-05:00 — #2
display:inline on the li get's them horizontal alright. I'm in a hurry now but you could use a technique that's called sprites: it uses one image instead of several different images. The result is achieved by adjusting the positioning.
Here's a nice how to.
ryanreese — 2010-01-27T23:59:12-05:00 — #3
And sprites is something you should look into. You combine many images into 1 file and then you assign (for example) all <li>'s the background image, then assign each <li> a specific class and use the background-position property to move the image around to make a particular section of hte image you put in there show :).
luki_be — 2010-01-28T08:17:33-05:00 — #4
You like to float huh? lol
cgacfox — 2010-01-28T09:36:56-05:00 — #5
I have read the tutorial on sprites and it looks interesting. However, those images are all attached to each other. I do want spaces between the buttons. How do I achieve this? Or do I just have an image such as I attached with the upper row and the lower row with no space between the rows? I am sorry that I am such a newbie at this...I really am trying to keep up with the ever-changing world of web design.
luki_be — 2010-01-28T09:45:22-05:00 — #6
If you want gaps between your images then you will have to adjust the background position in the css accordingly. The trick is to use the positioning to decide where the image shows up
cgacfox — 2010-01-28T10:07:47-05:00 — #7
LOL well my first attempt really screwed things up...I have to go to work now but I will play with this tonight. I did upload it to www.foxdenwebsolutions.com/CSS_site/index.html.
cgacfox — 2010-01-28T10:09:05-05:00 — #8
Never mind...I cut and pasted the code from the tutorial and didn't change the names of things....silly me!
cgacfox — 2010-01-28T10:17:47-05:00 — #9
I also need to change the dimensions to mine...as I said I will play with this tonight after work.
ryanreese — 2010-01-28T11:52:53-05:00 — #10
Yup :). It's slightly more buggy in IE but once you know what bugs are going to be triggered, fixing them before they appear makes it much funner to use them :).
luki_be — 2010-01-28T13:18:06-05:00 — #11
Yeah well, you probably now how much i like to float
cgacfox — 2010-01-28T22:42:25-05:00 — #12
Ok I need help...I have uploaded what I have using the tutorial and the math is all wrong for the positioning. The button is width 111px height 51px and there are 6 buttons. Could someone please tell me where I am messing up? Thanks.
ryanreese — 2010-01-28T23:07:14-05:00 — #13
In the image get rid of the space between the images and the edge of the image. Like, don't allow for any whitespace in the image. It makes it harder to then place the image accordingly.
Right now, you are close with the background-positions, but the extra whitespace in the iamge is screwing it up
luki_be — 2010-01-28T23:16:19-05:00 — #14
Maybe (probably) i wasn't clear in my answer about the space: leave the image as it is in the tutorial: no whitespace in the image itself. Use the css background-position to create the space between the buttons
Sorry for that.
cgacfox — 2010-01-29T00:19:00-05:00 — #15
I reworked the graphics and redid the math and got it to work. However, I don't like it as much as the graphics with the spaces between the buttons or the pillow emboss I had on it. I might play with it some more to figure out the right spacing to be able to keep how I originally designed it unless there is another way to do it besides the sprite way.
cgacfox — 2010-01-29T00:20:54-05:00 — #16
Ah just saw your answer after I posted my response...I will go ahead and redo the pillow emboss and rework the positioning then.
luki_be — 2010-01-29T09:25:31-05:00 — #17
It's up to you hat technique you use lol but using 1 image has a benefit:
Each separate images is a separate HTTP-Request, and the more of those you have, the less efficient your page is. So having 6 images for your nav instead of 1 ....
cgacfox — 2010-01-29T22:44:45-05:00 — #18
YAY got the nav to work like I needed! Thank you so much for all your help Luki and Ryan. Now I am moving on to getting all images centered on the page and getting the text centered in the content area. I had to remove all my wrappers and containers because it broke and I was getting confused. I will start a new thread for help on that. That way others can follow the progression of this better.
luki_be — 2010-01-30T12:39:39-05:00 — #19
Glad it worked