www.webdeveloper.com
Results 1 to 3 of 3

Thread: Display DIV Same Size (FF & IE)

  1. #1
    Join Date
    Nov 2007
    Posts
    362

    Display DIV Same Size (FF & IE)

    hi, the following code displays a div 100x100 in Internet Explorer, but not in FireFox (108x108). How do I get it to display at 100x100 in both browsers?

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style>
    body
    {
      MARGIN: 18px;
      PADDING: 0px;
    }
    
    div
    {
      WIDTH: 100px;
      HEIGHT: 100px;
      BORDER: 4px solid rgb(0,0,0);
    }
    </style>
    </head>
    
    <body>
    <div></div>
    </body>
    </html>

  2. #2
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    Code:
    <style type="text/css">
    body
    {
      MARGIN: 18px;
      PADDING: 0px;
    }
    
    div
    {
      WIDTH: 92px;
      HEIGHT: 92px;
      BORDER: 4px solid rgb(0,0,0);
    }
    </style>
    <!--[if lt ie 7]>
    <style type="text/css">
    body
    {
      MARGIN: 18px;
      PADDING: 0px;
    }
    
    div
    {
      WIDTH: 100px;
      HEIGHT: 100px;
      BORDER: 4px solid rgb(0,0,0);
    }
    </style>
    <![endif]-->
    Reference: http://www.positioniseverything.net/...s/multiIE.html

  3. #3
    Join Date
    Mar 2006
    Location
    Newcastle NSW Australia
    Posts
    4,033
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    This is an incomplete doctype throwing IE into quirks mode so that it uses the incorrect box model. The proper version of this doctype should be
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    However, new pages should use a strict doctype as you are not transitioning from old code, and the strict version looks like:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles