1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I Hate IE, formatting problem (no surprise)

Discussion in 'HTML & Website Design' started by nightmare5liter, Feb 23, 2006.

  1. #1
    I am trying to create a fixed size layout for a webpage but am unable to get the same results in ie and firefox.

    Consider the following code

    <table width="798">
    <tr>
    <td><img src="some_image" width="425"></td>
    <td><img src="another_image width="375"></td>
    </tr>
    </table>

    This code is in a css div with properties width:798px border_width:1px

    All other divs also have a width of 798px.

    The problem is that ie takes the image width of 425 and includes the 2 1px borders in that 425px while firefox takes the 425 and ADDS 2 1px borders making the whole image 427 px in width.

    Anyone have a solution that will work in both?

    Ive tried everything I can think of.
    SEMrush
     
    nightmare5liter, Feb 23, 2006 IP
    SEMrush
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,499
    Likes Received:
    377
    Best Answers:
    29
    Trophy Points:
    335
    #2
    The table is designed to display content in fields, by rows. It is content driven and the specs say that width and height properties are, at best, suggestions. Even after describing two algorithms for the rendering of tables, the W3 says user agents may choose some other (undefined) algorithm if the vendor prefers[1].

    Such freedom of expression is not a problem if you use tables to display tabular data. As a layout tool, you're eight years behind the curve and using the wrong technology.

    Additionally, border-width (not border_width) is added, as is padding to the width of the element. That it is not in IE, indicates you are likely not using a proper and complete DTD. Failure to use a DTD causes IE to fall back into obsolete (quirks) rendering mode.

    cheers,

    gary

    [1] A fellow coder called this the "get out of gaol (sic) free card". Yeah, he's a Brit. :) There must be a Monopoly&#174; version based on Portsmouth.
     
    kk5st, Feb 23, 2006 IP
  3. chachacallis

    chachacallis Well-Known Member

    Messages:
    1,087
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    128
    #3
    i hate the fact that the two browers show totally different layouts.
     
    chachacallis, Feb 27, 2006 IP
  4. SonicReducer

    SonicReducer Peon

    Messages:
    1,012
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Exactly, I dont hate IE or FF. I hate having to design for both!!
     
    SonicReducer, Feb 27, 2006 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,499
    Likes Received:
    377
    Best Answers:
    29
    Trophy Points:
    335
    #5
    Actually you don't need to design for two browsers. You code for standards based browsers (Firefox is best of breed at this time) and then patch or work around IE's shortcomings and bugs. It is important, though, that you use a proper DTD to force browsers into standards mode.

    If you code against an obsolete, non standards compliant, bug infested browser, you will write non standard, bug ridden code. You will play hell making it work across browsers.

    cheers,

    gary
     
    kk5st, Feb 27, 2006 IP
  6. SonicReducer

    SonicReducer Peon

    Messages:
    1,012
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Right, I alwasys design for FF first. But it still involves messing around with 2 browsers, when according to standards, good code should work on both. Whatever your feelings about IE, 95% of the public uses it.
     
    SonicReducer, Feb 27, 2006 IP
  7. someguy

    someguy Guest

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    SonicReducer your right in saying the vast majority use IE hence the need to design for it, but if FF renders it right at least you know its not you coding it wrong. If you know the code is right you can then patch it for IE.

    For example just had a great example that an <ol> was displaying all numbers in the list as 1 in IE, but correctly (1,2,3,4) in FF. Because we knew the code was correct we removed the width of the <li> and it works!
     
    someguy, Feb 28, 2006 IP