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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:03:57+00:00 2026-05-13T13:03:57+00:00

Consider the following <div style=width:150px;border:50px solid black>Test</div> If this is output onto a page

  • 0

Consider the following

<div style="width:150px;border:50px solid black">Test</div>

If this is output onto a page that IE8 renders in strict mode (or if you load into Firefox etc) then the inside of the div (the white area where test is) will be 150px wide but the div in total will be 50 + 150 + 50 = 250px wide (accounting for the border)

If this is rendered in Quirks mode then it will only be 50 + 50 + 50 = 150px wide.

The difference is in Quirks the width includes any border as explained here

If you are putting a html fragment onto a page and you do not know ahead of time which mode will be used are there any reliable hacks (css/javascript or otherwise) that will ensure that the div has the same overall dimensions in both Strict/Quirks mode on all major browsers (IE6/7/8, Firefox, Opera, Chrome)?

  • 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-13T13:03:57+00:00Added an answer on May 13, 2026 at 1:03 pm

    I think I’ve got it cracked (tested on IE 6/7/8 quirks and strict mode and FF3.5)

    Quriks/Strict mode differ on the width of a div only if there are padding/borders involved.

    So make an outer div to set the width, then an inner div with the border.

    The inner div is constrained be the width of the outer div – and both quirks/strict modes will render the same size.

    i.e.

    <div style="width:150px;border:50px solid black">Test</div>
    

    becomes

    <div style="width:150px;">
       <div style="border:50px solid black">Test</div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please consider the following HTML with styling. <div style=border: 1px solid;height: 600px;> <button id=create_new_estimate
Consider following: <div class=box> ... </div> .box{ width:500px; border-bottom: 1px solid #ccc; } It
This problem is only in IE. Consider the following HTML: <html> <body> <div style='position:absolute;left:1em;right:1em;top:1em;bottom:1em;overflow:auto;>
Please consider the following: <td style=width: 500px;> <div style=width: 400px;>SomeContent</div> </td> For some reason,
Consider the following tag: <div class=my_class style=width: 453px; height: 604px;> // stuff </div> I
Consider the following php code used for HTML output: echo <div id='logo2'> <a href='if(checkLanguage())
Consider the following: <p> <b> <div style=color:rgb(81,33,244)>Player1</div> </b> to overtake <b> <div style=color:rgb(187,4,0)>Player2</div> </b>
Consider the following code: $('div').click(function(){ $(this).animate({height:100}, 500) $(this).css({opacity:1}); }); Versus: $('div').click(function(){ $(this).animate({height:100}, 500); })
Consider the following example: HTML: <div id=cool-div></div> JS/jQuery: var ComplexObject = function() { this.Append
Consider the following HTML: <div id=Kees_1_test>test 1</div> <div id=Kees_12_test>test 2</div> <div id=Kees_335_test>test 3</div> 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.