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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:48:10+00:00 2026-05-30T02:48:10+00:00

Edit 2: It seems clear that no one seems to be able to understand

  • 0

Edit 2: It seems clear that no one seems to be able to understand what I’m asking, so I’ll try to illustrate it;

enter image description here

The area in the center has the id #navigation. This has the following CSS properties,

width: 960px;
margin: auto;
background: #e4bd04;

The reason it has a width of 960px, is because I would like the links in my navigational bar to remain within a 960px limit. I’d also like them centered, so I apply margin: auto. However, this means that my background only flows for 960px. I’d like the background to flow for the entire window width (100% of page), so that users with larger screens don’t end a huge chunk of white space at the top.

In order to prevent this, I nest #navigation into another id, #navouter, to which I apply width: 100%; and background: #e4bd04;, so that the background now appears to extend for the entire width of the window.

Is there any way to do this without using two elements as I’ve done?

  • 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-30T02:48:12+00:00Added an answer on May 30, 2026 at 2:48 am

    I’ve undestood, you don’t want to have 2 div to center another div with fixed width, isn’t it ?

    I don’t think that you’ll love it, but this is a solution :

    .nav {
        width:960px;
        position:absolute;
        left:50%;
        margin-left:-480px; // width / 2
    }​
    
    <body>
     <div class="nav">Test content</div>
    </body>
    

    Result for 300px div : http://jsfiddle.net/7GTCc/1/

    Or another, really ugly (lol) :

    .nav {width:960px;}​
    
    <center>
         <div class="nav">Test content</div>
    </center>
    

    Edit regarding your illustration

    “Is there any way to do this without using two elements as I’ve done?”

    No 🙂

    But if you only want the background to be 100%, don’t specify a background (color or url) to your #navigation.

    Last try to answer, test this :

    #navigation {
        min-width:960px;
        text-align:center;
    }
    

    Demo here : http://jsfiddle.net/7GTCc/3/

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

Sidebar

Related Questions

Which algorithms or data structures are used in auto-suggest features? It seems that edit-distance
Edit: From another question I provided an answer that has links to a lot
I have an Excel2010 VBA userform that has one comboBox, from which the user
I am working on an iPad app, and one of the features that has
This seems to work, it's a macro that expands to successive integers depending on
EDIT: It seems to be something with having the two queues in the same
It seems it allows you to edit the content of an element, but what
[EDIT] Based on feedback yes, VS2010 seems to support SL4 Library TDD despite a
Whenever I edit files on emacs, it seems a temporary file is created with
Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems

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.