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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:17:19+00:00 2026-06-05T14:17:19+00:00

If you look at the CSS box model spec , you’ll observe the following:

  • 0

If you look at the CSS box model spec, you’ll observe the following:

The [margin] percentage is calculated with respect to the width of the generated box’s containing block. Note that this is true for ‘margin-top’ and ‘margin-bottom’ as well. If the containing block’s width depends on this element, then the resulting layout is undefined in CSS 2.1. (emphasis mine)

This is indeed true. But why? What on earth would compel anyone to design it this way? It’s easy to think of scenarios where you want, e.g. a certain thing to always be 25% down from the top of the page, but it’s hard to come up with any reason why you would want vertical padding to be relative to the horizontal size of the parent.

Here’s an example of the phenomenon I’m referring to:

<div style="border: 1px solid red; margin: 0; padding: 0; width: 200px; height: 800px;">
  This div is 200x800.
  <div style="border: 1px solid blue; margin: 10% 0 0 10%;">
    This div has top-margin of 10% and left-margin of 10% with respect to its parent.
  </div>
</div>

http://jsfiddle.net/8JDYD/

  • 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-06-05T14:17:21+00:00Added an answer on June 5, 2026 at 2:17 pm

    Transferring my comment to an answer, because it makes logical sense. However, please note that this is unfounded conjecture. The actual reasoning of why the spec is written this way is still, technically, unknown.

    Element height is defined by the height of the
    children. If an element has padding-top: 10% (relative to parent
    height), that is going to affect the height of the parent. Since the
    height of the child is dependent on the height of the parent, and the
    height of the parent is dependent on the height of the child, we’ll
    either have inaccurate height, or an infinite loop. Sure, this only
    affects the case where offset parent === parent, but still. It’s an
    odd case that is difficult to resolve.

    Update: The last couple sentences may not be entirely accurate. The height of the leaf element (child with no children) has an effect on the height of all elements above it, so this affects many different situations.

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

Sidebar

Related Questions

Take a look at the following HTML and CSS. .box { border-radius: 15px; border:
I am having difficulties achieving Css 100% so my website can look right in
One of the css aspects which confuses me sometimes when I look at a
What to look for when I have associated a CSS file with my Default.aspx
After reading jQuery's CSS documentation , it doesn't look like it offers any advantages
I have to create one table using XSLT and CSS. The table should look
look here: http://jsfiddle.net/QTrat/10/ I want to stretch the red box to the floated children
I have a side bar menu composed of ul->li->a, styled with css to look
On Firefox, my css-styled buttons (rounded, with tiny icon before the button text) look
I made a tabbed box using css, html, and jQuery. I would like to

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.