Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    May 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Horizontal button menu - cannot get rid of small space?

    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...

    Code:
    <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?

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    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.
    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

  • #3
    New Coder
    Join Date
    May 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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_...index.html#css

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

    Code:
    #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?

  • #4
    New Coder
    Join Date
    May 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Good job getting your menu working!
    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-wi...ges/index.html instead.
    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


  •  

    Posting Permissions

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