dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: Quick Question

  1. #1
    Join Date
    Jul 2006
    Posts
    663

    Quick Question

    Lets say i have a DIV and i set the height to 100px and the width 100px and i apply a border to it of 2px. Now lets say i want to put an image in this DIV to fill it, should the image be 100px X 100px or should it be 98px X 98px to allow for the boder...

    I guess what i am asking is:


    When a border is applied to a an element such as a DIV or TABLE etc... does the border go on the outside of the element or the inside or where does it go?

  2. #2
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    Depends on the browser displaying it. FX keeps the div at 100px, placing the border on the "outside"; IE places the border "inside," making the div 98px wide.

    It's the classic "broken box model" of IE.

    Resource: http://css-discuss.incutio.com/?page=BoxModelHack

  3. #3
    Join Date
    Jul 2006
    Posts
    663
    thanks man or Lady

  4. #4
    Join Date
    Mar 2006
    Location
    Newcastle NSW Australia
    Posts
    4,033
    ????

    When using a complete and valid doctype on the page (which should be always), IE6 and above follow the same rules as any other browser - the set sizes of an element are the internal size, and padding and borders are added to this. The box model problem exists in versions of IE less than version 6, and the user base for these is very small and diminishing, so most don't worry about supporting it.

  5. #5
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    I thought only IE7 fixed this issue.... (?)

  6. #6
    Join Date
    Mar 2006
    Location
    Newcastle NSW Australia
    Posts
    4,033
    In standards mode (with a complete doctype), IE6 follows the proper box model, but reverts to the broken model in quirks mode. Quite often I find people inadvertantly put IE6 into quirks mode by omitting the uri section of the doctype.

  7. #7
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    Quote Originally Posted by Centauri
    In standards mode (with a complete doctype), IE6 follows the proper box model, but reverts to the broken model in quirks mode. Quite often I find people inadvertantly put IE6 into quirks mode by omitting the uri section of the doctype.
    Ah -- the URI. I know it's an issue with WYSIWYG editors; I had to change DW's string in the "normal" template for it to be correct.

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