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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:49:59+00:00 2026-05-27T07:49:59+00:00

I am scratching my head that why I need to put padding-top: 1px; under

  • 0

I am scratching my head that why I need to put

padding-top: 1px;
under #pageHeader identifier to get background image at top left set at #container otherwise it displays few pixels below from top.

Even If I put padding-top : 0; it doesn’t work.

Moreover it also works if I put it under #intro OR I remove h1 tag inside pageheader div.

My CSS file

html 
    {
        margin: 0;
        padding: 0;             

    }
body 
    { 
        font: 75% georgia, sans-serif;
        line-height: 1.95;
        color: #555753;         
        background: #fff url(../images/bottom.gif) no-repeat bottom right; 
        margin: 0; 
        padding: 0;
    }
#container 
    { 
        background: url(../images/bg.gif) no-repeat left top; 
        padding: 0 175px 0 110px;  
        margin: 0; 
        position: relative;
    }   
#intro 
    { 
        min-width: 470px;
        width: 100%;
    }
#pageHeader 
    {
        padding-top: 1px;   
        height: 87px;
    }

My HTML file looks like

<div id="container">
<div id="intro">
<div id="pageHeader">
<h1>Hello World!</h1>   
</div>
</div>
</div>

Edit~~
Its html and body.. actually in my code but I was messed up with editor while pasting 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-27T07:50:00+00:00Added an answer on May 27, 2026 at 7:50 am

    The phenomenon you’re observing here is called “collapsing margins”. The h1 element has a certain margin. This collapses with the margins of the outer divs, so the pageHeader div is shifted down. By setting a non-zero padding to the pageHeader div, you prevent the margins from collapsing.

    See the W3C specs, if you read carefully they say:

    “Two margins are adjoining if and only if: … no padding … separate them”

    The rules also say:

    “When two or more margins collapse, the resulting margin width is the maximum of the collapsing margins’ widths.”

    So the effect is that your outer divs which have top margins of 0 actually acquire the top margin of the h1 element which is the maximum of all the top margins.

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

Sidebar

Related Questions

I am scratching my head about this. My scenario are that I need to
This is an issue that's left me scratching my head. Most of the time,
I have a very annoying problem that has left me scratching me head when
I have a structuremap configuration that has me scratching my head. I have a
I have a tricky problem that has had me scratching my head for a
I've run into a weird issue that has had me scratching my head for
This has me scratching my head. I have a view controller that implements UIPopoverControllerDelegate
This may seem like a somewhat contrived example, but I'm left scratching my head.
I have been scratching my head since long now to get rid of following
I'm scratching my head in trying to get the multithreading to work as I

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.