Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9087341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:40:44+00:00 2026-06-16T21:40:44+00:00

I have a horizontal menu that has been created using an unordered list. The

  • 0

I have a horizontal menu that has been created using an unordered list. The menu is contained within a fixed width div:

<div class="mainContainer">
  <div>
    <ul class="menu">
      <li class="menuItem">One</li>
      <li class="menuItem">Two</li>
      <li class="menuItem">Three</li>
      <li class="menuItem">Four</li>
      <li class="menuItem">Five</li>
      <li class="menuItem">Six</li>
      <li class="menuItem">Seven</li>
    </ul>
  </div>
</div>​

To distribute the menu items evenly over the width I have use the “display: table” on the UL and “display: table-cell” on the list item. I have tried to create a space between each cell by using “border-spacing:3px 0px;”.

.mainContainer {
    width: 960px;
    margin: 0 auto;
    background-color:#999;
    height:100px;
}
.menu {
    list-style-type: none;
    border-spacing:3px 0px;
    padding: 0px;
    display: table;
    margin: 5px 0px 0px;
    text-align:center;
    height: 26px;
    width: 960px;

}
.menuItem {
    background-color: #eee;
    display: table-cell;
    position: relative;
    margin:0px 5px 0px 0px;
    padding:6px 0px;
    width: auto;
    cursor: default;
    color: #002F68;
}​

However I do not want a space to the left of the first menu item and a space to the right on the last item. How can I remove these spaces? IE8+ compatibility is required.

Full example in jsFiddle

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:40:45+00:00Added an answer on June 16, 2026 at 9:40 pm

    Here’s a fiddle.

    Instead of border-spacing on the whole menu, use the border attribute on the list items:

    .menu {
        list-style-type: none;
        /*border-spacing:3px 0px;*/  <-----remove this
        padding: 0px;
        display: table;
        margin: 5px 0px 0px;
        text-align:center;
        height: 26px;
        width: 960px;
    
    }
    
    .menuTab {
        background-color: #D2DCE0;
        display: table-cell;
        position: relative;
        margin:0px 5px 0px 0px;
        padding:6px 0px;
        width: auto;
        cursor: default;
        color: #002F68;
        border-left: 3px solid #999;  <-----Add this
    }
    

    Then, to correct the border on the far left add this pseudo selector (ie8 compatible):

    .menuTab:first-child{
         border-left: none;   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a horizontal animated menu that has a strange behavior because it works
i have a that contains a HORIZONTAL menu. the menu consists of an unordered
I have a ul list that I display as a horizontal menu. I'd like
I have a horizontal menu bar created using ULs and LIs. The issue I
I have created a horizontal menu with 5 tab options using a ul and
I have an unordered inline horizontal list menu, when my mobile media query kicks
I have a horizontal menu navigation. The code is: <div class=menu-holder> <ul class=menu> <li>
I have been trying to make the sub-menu horizontal. In my HTML it looks
I am aware that this question has been asked before, but I have tried
I want to make a horizontal menu that has an arrow over it that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.