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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:53:27+00:00 2026-06-13T11:53:27+00:00

When using a standard <nav> & <ul> it is easy to create navigation that

  • 0

When using a standard <nav> & <ul> it is easy to create navigation that appears on a single line:

enter image description here

Desktop: http://jsfiddle.net/Baumr/Be9ma/1/

Since this is for a responsive layout, on smaller displays, the navigation will contract into 3-columns (and maybe even 2) with media queries (not featured in code):

enter image description here

Mobile: http://jsfiddle.net/Baumr/Be9ma/

But it’s not spaced aesthetically:

Since the widths of the nav li elements are 33.3333% then the spacing is messed up — some navigation items are long, and some short. But the spacing isn’t fluid.

How can I adjust each column to be only as wide as the widest element + padding/margins? That is, without separating or nesting the ul out — which would break the semantics, and when viewed on a wide display.

Here’s the simple HTML:

<nav>
    <ul>
    <li>Home</li>
    <li>Very Long Link</li>
    <li>Blog</li>
    <li>About</li>
    <li>Also Long Link</li>
    <li>Email</li>
    </ul>
</nav>​

And here’s the relevant CSS:

nav {
    clear: both;
    background: pink;
}

    nav ul {
        padding: 20px 10px 0 30px;
        margin: 0;
        overflow: hidden;
        font-size: 16px;
    }

    nav li {
        font-variant: small-caps;
        text-decoration: underline;
        list-style: none;
        display: block;
        float: left;
        padding: 0 0 30px 0;
        margin: 0; 
        width: 33.33333%;
        float: left;
}

Curious to hear your ideas. Thank you in advance!

P.S. I would like to stress cross-browser compatibility and semantics.

  • 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-13T11:53:28+00:00Added an answer on June 13, 2026 at 11:53 am

    Add some @media queries for mobile.

    http://jsfiddle.net/bf9cB/
    You’ll need to open/contract the center bar to see the change

    @media only screen and (max-width: 480px) {
        nav li { max-width:160px; text-align:center } /* This would only allow 3 to fit */
    }
    
    @media only screen and (max-width: 320px) {
        nav li { max-width:106px; text-align:center }
    }
    

    Betting the font size will be a factor at 320px wide (FYI).
    Your problem reminds me of a book I read recently: “Mobile First”. In a nutshell: start your build at mobile, and work ‘up’ from there. Def worth checking out.

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

Sidebar

Related Questions

I am using standard Twitter-Bootstrap code for nav-tabs - http://twitter.github.com/bootstrap/javascript.html#tabs All functionality works but
I'm using standard ASP.NET and a Web.sitemap file which describes the navigation structure of
I'm writing a simple data UI using standard .Net databinding to a typed DataSet
I have an application running under WebLogic that is using standard forms authentication. The
hey guys, I have a standard nav bar with an unordered list and using
I'm using jQuery to build a drop-down nav based on a standard ul>li structure.
I'm using standard BMP images for buttons that come with visual studio. When using
I'm working on a library that is currently using standard tcp sockets. An end
I want to know how can I build UIs like skype using standard .Net/C#.
I have an app that is using standard out of the box form validation

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.