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.
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® version based on Portsmouth.
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
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 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!