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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:01:03+00:00 2026-05-22T17:01:03+00:00

In this example , why doesn’t the fixed #header (the at the top) start

  • 0

In this example, why doesn’t the fixed #header (the at the top) start at the top of the page, but in this example it does?

The only difference is that i changed the “margin” of #content to “padding” instead (repsectively).

So why does this tiny change have a huge impact? How do I put the fixed #header at the top of the page while still using “margin” for the #content?

  • 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-22T17:01:04+00:00Added an answer on May 22, 2026 at 5:01 pm

    It’s because of collapsing margins.

    If the top and bottom margins of a box
    are adjoining, then it is possible for
    margins to collapse through it. In
    this case, the position of the element
    depends on its relationship with the
    other elements whose margins are being
    collapsed.

    In this case, the margin can push down the #header (that has position: fixed) unless you give it a top value other than the default of auto.

    A way to fix this is to add overflow: hidden to #wrapper: http://jsfiddle.net/CyaJ8/6/

    This works because:

    Margins of elements that establish new
    block formatting contexts (such as
    floats and elements with ‘overflow’
    other than ‘visible’
    ) do not collapse
    with their in-flow children.

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

Sidebar

Related Questions

This example doesn't validate the presence of the title for me: require 'rubygems' require
I have the following code that simply uses a jquery ui modal dialog to
I am trying to loop through a bunch of documents I have to put
So I'm trying to learn how to implement method collection for a plugin based
I habe a problem with my latest Liferay Portlet or rather a JSP I'm
I am unable to use Google Test's ASSERT_THROW() macro in combination with multiple template
I have long been a fan of Python's doctest library for the simple reason
I have a complicated combined model for which I can define a likelihood in
These are the class definitions <?php abstract class MyTemplate { protected $arrayOfSpaces; protected $arrayOfVariables;
I've been through multiple sites, documents and tutorials and they all say the same,

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.