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

  • Home
  • SEARCH
  • 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 493923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:27:01+00:00 2026-05-13T05:27:01+00:00

If I have a 100% wide div element with 12 pixels of padding to

  • 0

If I have a 100% wide div element with 12 pixels of padding to the left and to the right, and I have an element inside the div that I want to span from one corner of the screen to another (bridging the 12 pixel gap), do I have any chance of “breaking out” of the surrounding div without using absolute positioning?

Using position:relative; left:-12px won’t work alone, because the div is 100% wide and I can’t specify “100% + 12px” to make the inner element touch the right hand corner.

  • 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-13T05:27:01+00:00Added an answer on May 13, 2026 at 5:27 am

    A pure CSS solution:

    #breakout { margin-left: -12px; width: 100%; padding-left: 12px; padding-right: 12px; } 
    

    Tested working in FF 3.5 and IE8. Other browsers not tested. With IE7 or before it might be weird.

    I think the reason this works is because the browser adds the tag width with it’s white space (padding). In this case margin-left: -12px shifts the div to visually look like it’s ignoring the parent’s padding: 12px. At first I thought width: 100%; padding-right: 12px; alone would work, but it didn’t. I realized this is because the box model being used. It didn’t factor in the initial padding because it was collapsing with the parent’s padding (or so I am assuming).

    For reference here was my test page:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>Hello</title>
        <style type="text/css">
            html, body { padding: 0; margin: 0; color: white; }
            #outer { padding: 12px; background-color: blue; }
            #breakout { background-color: red; margin-left: -12px; width: 100%; padding-right: 12px; padding-left: 12px; }
        </style>
    </head>
    <body>
        <div id="outer">
            <h3>Some content</h3>
            <div id="breakout">Breakout</div>
            <h3>More content</h3>
        </div>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have 3 divs aligned inside a container div, like this: [[LEFT]
I have a div element that is 980px wide and I'd like to be
I have around 100 models, from MCMCglmm, that give output similar to this: >
I have a DIV which is a banner stretching 100% wide for the top
I have a div container that is 600px wide and 30px high, and it
I have some some rows of image thumbs inside anchors inside a div, one
I have a box that is 950px wide. Within this box I want to
I have a bodyMain div of 100% width. Inside it is a body div
I have 100 threads. I want to run 10 thread before 10 another threads
I have 100 web servers and noticed that some of them have request filtering

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.