Results 1 to 2 of 2

Thread: Padding issue

  1. #1
    Join Date
    Oct 2006
    Posts
    1

    Padding issue

    Why does firefox made padding expand the width of a div, instead of pushing the text area in? Explorer doesn't alter the width, only the area that text and other elements appear. Can anyone help me figure out how to make it display similarly in firefox AND explorer?

    Here is an example, check it out in both browsers.

    Code:
    <html>
    <head>
    <title>test</title>
    <style type="text/css">
    #shell {
    	margin:0px;
    	padding:0px;
    	border:1px solid black;
    	width: 200px; }
    #left {
    	margin:0px;
    	padding:10px;
    	width:100px;
    	float:left;
    	background-color:red; }
    
    #right {
    	margin:0px;
    	padding:10px;
    	width:100px;
    	float:left;
    	background-color:blue; }
    </style>
    </head>
    <body>
    <div id="shell">
    <div id="left">hello</div>
    <div id="right">world</div>
    </div>
    </body>
    </html>

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    The answer is that IE in quirks mode includes padding within a div box but outside the box when not in quirks mode and it then works like Firefox.

    Add a Doctype right at the top of your html file before the <html> tag.
    Read the second paragraph here:-
    http://www.wickham43.supanet.com/tut...raladvice.html

    Quirks mode is out of date for the reason you have found.
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. Having problems with a footer - can someone help?
    By DankaShine in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 07 Jun 2006, 12:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •