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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:57:56+00:00 2026-05-30T18:57:56+00:00

I read this and wrote this code: .wholePageDivForCentering { width: 80%; white-space: nowrap; display:inline-block;

  • 0

I read this and wrote this code:

  .wholePageDivForCentering
   {
        width: 80%;
        white-space: nowrap;
        display:inline-block;
        margin: 0 auto;
        border: 4px solid red;

       /* other stuff I tried........*/
       /*padding-left: 10%;*/
       /*margin-left: 10%;*/
       /*padding-right: 10%;*/
       /*margin-right: 10%;*/

   }



  <body>
     <div class="wholePageDivForCentering">
        <h2>Hello from the page</h2>
       <!-- stuff such as 2 nested divs contained text labels, and a small image -->
     </div>
  </body>

I put a solid-red, 4-pixel border around my outermost div for a reason.

I wanted to see if that thick red border rectangle around that outermost div would
horizontally center itself on the page.

IT DID NOT.
EDIT: My outermost div stays on the left when the browser is maximized.

You can see I tried more than one thing. In my opinion, I should be able to:

  • tell this outermost div, the one with the thick red border, to take up 80% of
    the browser window

  • then using the advice from the above SO post (again, here) — get this
    outermost div always taking up 80% of the browser window but HORIZONTALLY CENTERED
    on the browser window.

Me personally? I think my margin-left = 10%, margin-right=10% should do it but no.

To see what I want — open Craigslist at http://sfbay.craigslist.org/
and maximize the browser window (the main page, not a nested page, of the CL site).

The horizontal width of the whitespace on either side of the Craiglist main
page is the same when you maximize the browser. The main page’s columns are
horizontally centered.

Because (perhaps) that page has a centered div that surrounds everything
else on the main page.

How do I do it?

  • 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-30T18:57:57+00:00Added an answer on May 30, 2026 at 6:57 pm

    Take out display:inline-block and it should work.

    Here is a Jsfiddle (click Run): http://jsfiddle.net/zKm6b/

    I also recommend using an id instead of a class for that div. I hope that helps!

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

Sidebar

Related Questions

Read through this code. I wrote it at my desk in 5 minutes, it's
I've read this about structure padding in C: http://bytes.com/topic/c/answers/543879-what-structure-padding and wrote this code after
If you read this thread before - forget everything I wrote , I must
I wrote this code in C: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h>
I wrote this java J2SE code : import gnu.io.CommPort; import gnu.io.CommPortIdentifier; import gnu.io.SerialPort; import
I wrote a code in ASP.NET that read data from SQL Table and show
I wrote this simple test code, by adapting a piece from a book, to
I'd like to empty read buffer of the socket so I wrote follow code...
I want to set page backgroudImage using jQuery. I wrote this code but it
I try to wrote code that read data from stdin: size_t bufSize = 1024;

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.