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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:22:21+00:00 2026-06-01T06:22:21+00:00

I’m attempting to layout my header (logo and navigation) so that the logo is

  • 0

I’m attempting to layout my header (logo and navigation) so that the logo is in the center of the page. Right now, everything works fine if the left and right navigation are the same width. But I’d like the logo be in the center of the page regardless of the width of the navigation elements. I’m not worried about the vertical alignment right now, just the horizontal.

  • Logo Must be horizontally centered (with respect to the browser window)
  • Need to have navigation elements on the left and right of the logo
  • The number of navigation elements and widths of each element may vary (the left and right side will most likely differ in width)
  • I want the header to be 100% width (the width of the browser window)
  • The HTML and CSS can completely change from what I have listed
  • Only use JavaScript for CSS selector/property fallback (i.e. Dean Edwards IE7), HTML5 support (i.e. shim/v), etc.

Example Code

jsFiddle

Logo / Navigation Mock-Up (nothing is to scale)
Logo / Navigation Mock-Up

HTML

<header>
    <nav class="nav1">
        <ul>
            <li><a href="http://example.com">Hello World</a></li>
            <li><a href="http://example.com">Hello World</a></li>
            <li><a href="http://example.com">Hello World</a></li>
            <li><a href="">Hello</a></li>
        </ul>
    </nav>
    <img src="http://markschamel.com/upload/blue.square.png" />
    <nav class="nav2">
        <ul>
            <li><a href="">Hello World</a></li>
            <li><a href="http://example.com">Hello</a></li>
        </ul>
    </nav>
</header>

CSS

header {
    width: 100%;
    text-align: center;
}
nav.nav1 {
    text-align: right;
    display: inline-block;
}
nav.nav2 {
    text-align: left;
    display: inline-block;
}
nav ul {
    overflow: hidden;
}
nav.nav1 li {
    float: left;
}
nav.nav2 li {
    float: left;
}
  • 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-01T06:22:22+00:00Added an answer on June 1, 2026 at 6:22 am

    I solved my own question. It’s a little hack estimating the width of the ULs with percentages with min-width. There are a couple of other minor updates.

    Demo: http://jsfiddle.net/S2ySk/3/

    HTML

    <header>
        <nav class="nav1">
            <ul>
                <li><a href="http://example.com">Hello World 1</a></li>
                <li><a href="http://example.com">Hello World 2</a></li>
                <li><a href="http://example.com">Hello World 3</a></li>
                <li><a href="">Hello</a></li>
            </ul>
        </nav>
        <img src="http://markschamel.com/upload/blue.square.png" />
        <nav class="nav2">
            <ul>
                <li><a href="">Hello World</a></li>
                <li><a href="http://example.com">Hello</a></li>
            </ul>
        </nav>
    </header>
    

    CSS

    header {
        width: 100%;
        text-align: center;
        background-color: #c87137;
        white-space: nowrap;
    }
    nav {
        min-width: 40%;
        display: inline-block;
    }
    nav.nav1 {
        text-align: right;
    }
    nav.nav2 {
        text-align: left;
    }
    nav ul {
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        background-color: #ff0000;
    }
    nav li {
        background-color: #008000;
        white-space: nowrap;
    }
    nav.nav1 li {
        float: right;
    }
    nav.nav2 li {
        float: left;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping 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.