View Full Version : Horizontal button menu - cannot get rid of small space?

06-11-2010, 12:24 PM
My site is 980 pixels wide and it features a horizontal strip of seven individual buttons, each of which is 140 pixels wide. By my calculations, 7 x 140 = 980 which should mean that all of the buttons will fit across the width of my site.

However, there is a small gap between each button - possibly about 5 pixels - which means that the last right hand button will not fit on the end, and is moved over to below the first button on the left hand side?

All of these buttons have been placed using HTML within a separate menu div tag as follows...

<a href="http://www.xxxxxxxxxx.co.uk/home.html">
<img src="images/home_button.jpg" width="140" height="32" border="0"></a>

Any thoughts about removing these small gaps?

I would also like each image to show a different rollover / hover image once the cursor is moved on top of it. I assume this is where the CSS will come in. Any thoughts?

06-11-2010, 04:08 PM
Hello David.W.S,
You don't give us enough information to know where the 5px gap comes from. Give us a link to the test site.

For your rollover, there are some examples of how to do that here (http://nopeople.com/design/CSS%20tips/index.html).

06-14-2010, 10:57 AM
OK Excavator, and many thanks for your help.

I have redone my coding from scratch based on this topic > http://nopeople.com/CSS/h_menu_with_images/index.html#css

I can see that each separate rollover image is placed within the css coding, as highlit in red here...

#rollover1 a:link,
#rollover1 a:visited,
#rollover1 a:active {
width: 140px;
height: 32px;
background: url(01vision.jpg);
float: left;

...but I cannot work out where the non-rollover version of each image must be placed, ie within the html or the css?

Any thoughts?

06-14-2010, 12:11 PM
I've sorted my rollover images now thank you - the mistake I made was having two separate images, one for the button and one for the rollover button! I hadn't realised that the two wanted combining into one file with one above each other!

It all works fine now using the above link thank you, and I have no issues with small 5 pixel gaps anymore. As soon as I complete the edit of all of my buttons and refresh my coding, I'll let you know if there are any other problems.

06-14-2010, 05:38 PM
Good job getting your menu working! :thumbsup:
That's not my favorite example. I've considered getting rid of it many times... but it's a valid alternative to using an unordered list for a horizontal menu so I keep it.
I would probably have recomended http://nopeople.com/CSS/h_ul_menu-with_images/index.html instead.