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 6655221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:29:25+00:00 2026-05-26T01:29:25+00:00

Starting point: End point: I’m trying to have a horizontal navigation bar that fills

  • 0

Starting point:

starting point

End point:

end point

I’m trying to have a horizontal navigation bar that fills 100% of it’s container. In the first example, you’ll see all of the items aligned to the left. I’m trying to get it to fill the full width of the container as shown in the second example. I want the spacing between all of the items to be uniform (unlike the way it’s shown, I just put that together quickly to give you an idea of what I’m trying to do). I need the text to not be an image and the container it goes in is fluid not fixed.

  • 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-26T01:29:25+00:00Added an answer on May 26, 2026 at 1:29 am

    With a static number of elements it’s easy – http://jsfiddle.net/X56cJ/

    However, if you want to have uniform spacing between the text, not the elements themselves – it becomes tricky. Again, if the number of elements doesn’t change, you do it with css classes and static widths. Otherwise it’ll have to be javascript

    EDIT: Here’s the JavaScript way of getting same space between elements.

    HTML:

    <ul class="menu">
        <li>About Us</li>
        <li>Our Products</li>
        <li>FAQs</li>
        <li>Contact</li>
        <li>Login</li>
    </ul>
    

    JS:

    function alignMenuItems(){
        var totEltWidth = 0;
        var menuWidth = $('ul.menu')[0].offsetWidth;
        var availableWidth = 0;
        var space = 0;
    
        var elts = $('.menu li');
        elts.each(function(inx, elt) {
            // reset paddding to 0 to get correct offsetwidth
            $(elt).css('padding-left', '0px');
            $(elt).css('padding-right', '0px');
    
            totEltWidth += elt.offsetWidth;
        });
    
        availableWidth = menuWidth - totEltWidth;
    
        space = availableWidth/(elts.length);
    
        elts.each(function(inx, elt) {
            $(elt).css('padding-left', (space/2) + 'px');
            $(elt).css('padding-right', (space/2) + 'px');
        });
    }
    

    Full example here

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

Sidebar

Related Questions

I have these functions here that will record the time between starting point and
I have created a simple BuildProvider as a starting point, and althogh I get
Is there a Rails plugin or a rubygem that gives you a starting point
Iam an F# newbie, I have following starting point: type aB = { ID:
I have the following query that I am trying to execute. It is the
I have been working on a jqplot horizontal bar graph. I WANTED TO HAVE
My starting point is basically Ryan Bate's RailsCast . I have modified his code
I'm working on a C program that crops .ppm files from a starting point
The code bellow is the small starting point for a new way ( for
I am looking for an acceptable starting point for placing applications settings in a

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.