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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:57:40+00:00 2026-05-19T15:57:40+00:00

I have a fixed-width page that I want to add a simple border to

  • 0

I have a fixed-width page that I want to add a simple border to with the Border CSS command. However, I don’t want this border to balloon the page and cause smaller screens to have a horizontal scrollbar. I’m not too great with CSS, but I know enough that I looked into using negative margins to offset the border’s width since I had already done something similar to add borders to other elements that I don’t want moving. But when I do so on my main container div, everything gets thrown off-center and smashed up to the left side of the page. I’m using the Blueprint CSS framework and I figured there was something in there that was messing with my margins, and I found the main container is applied a “Margin: 0 auto;” to center it on the page.

So, I ask now, how the hell can I apply a negative-margin border to a page while still centering the layout on-screen? I’ve tried to wrap the container in a div and apply the border and negative-margin to it, but no dice, I tried nesting a div inside the container and applying the border to the container, but that went badly as well. Somebody throw me a bone here!

  • 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-19T15:57:41+00:00Added an answer on May 19, 2026 at 3:57 pm

    If the negative margin is working, you can get the centering back by adding a wrapper div with a fixed width and margin: 0 auto.

    In my testing, the negative margin didn’t change the width of the box. A few other strategies:

    1. Adjust the width of your div to offset the width added by the borders.
    2. Add a background image to the div that simulates left and right borders.
    3. Use JavaScript to detect the width of the window and remove the border when necessary.
    4. Add body { overflow-x: hidden } to suppress the horizontal scrollbar.
    5. Use a CSS3 media query to add the border only when there’s enough room (optionally falling back to JavaScript (see #3) for older browsers).

    Update: Instead of negative margins, you can probably use box-sizing: border-box so that the border doesn’t add to the element’s width in the first place.

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

Sidebar

Related Questions

I have a fixed width div on my page that contains text. When I
I have a fixed width DIV containing a table with many columns, and need
I have a container div with a fixed width and height , with overflow:
I have an input[type=radio] element inside a block container of fixed width. The supporting
I have a really simple search form with the following Label (Search) Textbox (fixed
I have an application that has a primary layout of portrait (it is fixed
Header, footer and sidebars have fixed position. In the center a content area with
I can't make td Date to have fixed height. If there is less in
I have a fixed-length data file need to persistence into database. I use a
If I have an array of a fixed size depending on how it is

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.