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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:47:16+00:00 2026-05-13T11:47:16+00:00

Chrome seems to measure an elements width from the inside of the margin including

  • 0

Chrome seems to measure an elements width from the inside of the margin including padding but Firefox and IE measure the boxes width where the border is (not including padding but inside margin). measuring the elements width from the border makes sense to me and is also helpful when coding because turning on borders will let you see the width of the element very easily but my question is what the CSS specification says is the correct way to measure the width of an element and if chrome is wrong or IE and Firefox are

thanks for your help

  • 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-13T11:47:17+00:00Added an answer on May 13, 2026 at 11:47 am

    The W3C CSS 2.1 Box Model Specification says that the width of an element does not include margin, border or padding.

    In fact by specifying the CSS width or height properties you specify the space available to the content of a box (that is called content area in the specification) which does not include padding, margin or border.

    Look at this example:

    div { width: 100px; padding: 10px; margin: 20px; border: 2px; }
    

    The distance between the vertical borders (including them) is width + padding-left + padding-right + border-right-width + border-left-width.
    Margins are outside of the border-box.
    The width (as intended by the CSS specifications) is instead 100px.

    Internet Explorer renders web pages in Standard Mode or in Quirks mode.
    If you want IE to behave as it should (so following CSS Standards) you have to force it to use the Standard Mode by using one of the DOCTYPEs reported in this article: http://www.alistapart.com/articles/doctype/

    This technique is called doctype-switch.

    Firefox and the majority of other browsers follows the standard box model.

    You can read the W3C box model specification here: http://www.w3.org/TR/CSS21/box.html#box-dimensions
    But I suggest you to read a more easy-to-read (but really good) article like this: http://reference.sitepoint.com/css/boxmodel

    Another thing to say is that the CSS 3 specifications will include the box-sizing property which will allow to specify for every element the way to interpret the width property (so if excluding or including padding and borders).
    Anyway it will take years for the majority of browsers to implement the new (and not yet finished) CSS 3 specifications.

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

Sidebar

Related Questions

I'm developing a website and using codes below.Chrome seems to work fine, but Firefox
I'm writing into a session cookie from my plugin in chrome. The browser seems
Google Chrome seems to have a bug when overflowing content inside of a fieldset.
What is the easiest way to read json from Firefox or Chrome's developer console?
I want to refresh with new hash but it seems chrome just changes the
When adding border-radius to an element with a transparent border, Chrome seems to double
The number of IE addons seems to be far lower than Firefox and Chrome
I'm using google chrome 5.0.307.9 beta under ubuntu 9.10 and it seems not properly
My Chrome seems to have some problems with hovering over a tr element inside
window.onerror in Firefox and Chrome seems to discard the real error message/location and always

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.