Forum Moderators: not2easy
I have a serious problem with ie6 and width. I am designing a site that is 3 col liquid layout: full width header, 200px left col, 200px right col and content in the middle.
It all works very well until I try to put divs in the content column and view them in ie6.
In one page, I want a div called description to take up no more than 30% of the content width, with an image beside it. ie6, as we all know, doesn't understand how to limit the width to 30%. I have spent all day googling, reading forums, reading css articles, reading javascript articles all to no avail. How the hell do I make this div 30%, and no more than 30%?
Secondly, on the contact page: the company in question has 3 offices. I want the three addresses beside each other inside the content div, much like this
<tr>
<td>address1</td>
<td>address2</td>
<td>address3</td>
</tr>
would achieve.
I am sorely tempted to throw standards out the window and use the lightweight code above!
So you want to make sure that the block that you want 30% width of is the FIRST container it encounters (it's parent), UNLESS it is positioned absolutely, in which case you need to make your parent div position:relative (no coordinates necessary) to make it be the containing block.
For your second problem, here's something you can do:
Use the <address> tag for each location, and in the CSS specify address{float:left;
width:33.33%;/*optional*/
height:?em /*optional*/}
the optional attributes would most likely be used if you wanted to style a border or background color on them, so that they all appear quite uniform.
There's really nothing much wrong with using tables there either though, in my opinion. Some people would complain that it's not tabular data so tables shouldn't be used. While I greatly dislike using tables for presentational layout, for something really simple like this it's fine.
While I have no problem with it, I still wouldn't bother using it unless I had specific visual design goals, since the CSS method is still lighter HTML, and uses the address tag while it's at it (granted you could wrap the table cells in the tag too, but makes for more markup))
[edited by: Xapti at 7:16 pm (utc) on July 4, 2007]
I hadn't thought of using the address tag. Remember reading about it in an article entitled something like "the most useful under-used html tags".
I'll give it a bash now and report back.
Thanks for the info.
<dl>
<dt>Our company addresses:</dt>
<dd>Address number one... blah blah blah</dd>
<dd>Address number two... blah blah blah</dd>
<dd>Address number three... blah blah blah</dd>
<dl> (and it is okay to have multiple <dd>s - i checked!)
To get IE to support it, you can use javascript like minmax.js or ie7.js.
Another option which isn't very great, but you might consider, is having it always 30% width, but having a div around it with overflow:auto, so that if an item is larger than that width, it will scroll. Will not work with small items though like text, or small images, since they will wrap to new lines.
And with the address floating, that's really strange behaviour. IE6 is so buggy. The issue you will have with display:inline is that it can only be 1 line... typically addresses and/or contact info is 3-5 lines high, which you can't do as inline styled unless you want them on top of each other.
Javascript could probably fix the problem for IE, but I've never heard of the fix, or even the problem, so it might take searching, or D.I.Y.
Another fix would be to wrap each address in a div, and have the divs to float.
[edited by: Xapti at 1:47 am (utc) on July 5, 2007]
Regarding the <address>, using display: inline works in IE6, even though they are 5 and 6 lines each. Don't ask me!
width: expression(this.offsetWidth>130?132:'');
Not perfect, because if IE6 is used to view the page through a resolution higher than 1024x768 there is a lot of whitespace. I tried to incorporate an expression that takes into account document.body.clientWidth but couldn't get anywhere with it.