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

  • SEARCH
  • Home
  • 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 7025785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:01:30+00:00 2026-05-28T00:01:30+00:00

This is is my problem: – I need to make a horizontal menu –

  • 0

This is is my problem:
– I need to make a horizontal menu
– It needs to be flexible so no set width
– The frist and the last element have to be align to the very beginning and end of the nav
– The nav element can be different width
– The gap between the elements have to be equal (except no gap before the first element and no gap after the last )

My current solution is like this (see it in action here http://jsfiddle.net/wKjVq/):

ul{
    -webkit-box-orient: horizontal;
    display: -webkit-box;
    width: 100%;
}

.empty {
    -webkit-box-flex: 1;
}
<ul>
    <li>Element 1</li>
    <li class="empty"></li>
    <li>El 2</li>
    <li class="empty"></li>
    <li>Element three</li>
    <li class="empty"></li>
    <li>Element 4</li>
</ul>

By using box flex the empty list elements makes even gaps between the “real” nav elements.
I’m happy with the outcome of this solution but not really happy with using empty divs.

So my first questions is: Am I missing something totally obvious?
My 2nd question is: Do anyone else have any other solution (preferably in css 2 but css3 is fine as long as there is a nice fallback)?

  • 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-05-28T00:01:31+00:00Added an answer on May 28, 2026 at 12:01 am

    You can remove the empty divs if you add box-pack: justify:

    ul {
        -webkit-box-pack: justify;
        -moz-box-pack: justify;
        box-pack: justify;
    }
    

    See: http://jsfiddle.net/thirtydot/wKjVq/3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem has kept me busy for the last hours. I have two sections
This problem has been kicking my butt for a few days now. I have
This problem has bugged me so many times and i have now decided to
This problem has been driving me mad. Here's the general gist: I have two
This problem is driving me crazy, I'm sure I'm missing something. I need to
This problem is making me crazy. Actually I have multiple problems. First one: Why
This problem is giving me a real headache. I have two tables in my
This problem is driving me nuts. I have a prototype UITableViewCell in my storyboard.
This problem may be a bug. i have spent too much time trying to
This problem has been bothering me for sometime now, I have not settled on

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.