Quick Question

Discussion in 'HTML & Website Design' started by oo7ml, Nov 14, 2007.

  1. #1
    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?
     
    oo7ml, Nov 14, 2007 IP
  2. IngaOz

    IngaOz Peon

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I believe you can make that image 100% (no pixels) or if you need pixels then 98x98px.
     
    IngaOz, Nov 14, 2007 IP
  3. Dwaighty

    Dwaighty Peon

    Messages:
    358
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It differs from browser to browser. Firefox will add the border outsite those 100px, but IE won't. So if you have this piece of code:

    <div style="width: 100px;height: 100px;border: 2px solid black;background:blue;">
    &nbsp;
    </div>
    Code (markup):
    it will actually have 102x102 pixels in FF and 100x100 in IE. Internet Explorer is always the most troublesome...
     
    Dwaighty, Nov 14, 2007 IP
  4. oo7ml

    oo7ml Well-Known Member

    Messages:
    656
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #4
    Wow, i thought i was asking a very stupid question but that is very interesting... thanks guys
     
    oo7ml, Nov 14, 2007 IP
  5. BackOfTheNet

    BackOfTheNet Peon

    Messages:
    344
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    IE is rubbish well 6.0 ++ anyway lol The latest version 7.0 ++ reads the pages juts like firefox now yay!!!

    A good idea is to display Firefox referral banners from adsense on your pages and display that your site functions better in firefox you may earn a few $ for your troubles.
     
    BackOfTheNet, Nov 15, 2007 IP
  6. xsabrina.chic

    xsabrina.chic Peon

    Messages:
    131
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    when you apply a border to a exact width and height.. it really adds if 2px border, all in all will be 102px :)
     
    xsabrina.chic, Nov 15, 2007 IP