IE6!! CSS display problem.
Author
Discussion

BliarOut

Original Poster:

72,863 posts

263 months

Friday 26th February 2010
quotequote all
First things first, I know I should be redirecting IE6 users to www.thebackofbeyond.com but I have a customer who has some on his network and they pay me a handsome retainer so IE6 problems it is wink

I've got a div and there are three tables that sit neatly below each other exactly as they should in IE>6 and other browsers but in IE6 they cascade down and across like a flight of stairs banghead Now I'm assuming this is to do with IE6's stty rendering engine not following the rules but how do I track down what's causing it to misbehave?

The tables fit within the div (I have another version of this form with a single table that behaves perfectly) but as soon as I add a second table they start cascading by what I assume is double the margin etc.

Help, it's driving me mad!

The Excession

11,669 posts

274 months

Friday 26th February 2010
quotequote all
wrap each table in it's own private div, put all these divs in the containing div, then go for a tradtional 3 column layout, float one of te table divs left, the other right, the one left over will sit in the middle.

I think

BliarOut

Original Poster:

72,863 posts

263 months

Friday 26th February 2010
quotequote all
lol, you think biggrin

I forgot to mention, I want them sitting on top of each other. Due to column widths etc they don't readily lend themselves to a single table which I already know would work 'correctly'.


john_p

7,073 posts

274 months

Friday 26th February 2010
quotequote all
Tried putting a <div style="clear:both"></div> after each table div ?

I can recommend IETester for these eventualities BTW smile


tomash

177 posts

304 months

Friday 26th February 2010
quotequote all
try loading the IE developer toolbar that should show you which div is actually causing the problem

http://www.microsoft.com/downloads/details.aspx?fa...

And use the proprocessor directives to override the css classes for ie so that you dont stuff up the other browsers.

BliarOut

Original Poster:

72,863 posts

263 months

Friday 26th February 2010
quotequote all
john_p said:
Tried putting a <div style="clear:both"></div> after each table div ?

I can recommend IETester for these eventualities BTW smile
That did the trick straight away thumbup So what idiosyncrasy of IE6 did I trip over this time and what did that do to correct it?

evenflow

8,851 posts

306 months

Friday 26th February 2010
quotequote all
IE6 automatically gives an extra 3px width to a float, maybe this pushing things out of line?
The clear:both will mean that no floating elements are allowed to the side of the preceding floating element, so it will appear underneath as it should in your case.

BliarOut

Original Poster:

72,863 posts

263 months

Friday 26th February 2010
quotequote all
You learn something new every day biggrin I did try shrinking the tables to silly sizes but that didn't do it. Hey ho, as long as it works I don't care...

BliarOut

Original Poster:

72,863 posts

263 months

Friday 26th February 2010
quotequote all
Right, I've been brushing up on my knowledge of css so I can better understand for the next time I hit a bugette.

Is my understanding of the following correct?

A div applies to a block level element and is invoked with a style= tag.

A span applies to an inline element and is invoked with a class= tag.

The css may contain instructions that relate to both inline and block elements, ie. font size and colour.

In the actual css :

A class tag begins with a dot.

An ID is unique within an HTML document and is defined with a hash.



john_p

7,073 posts

274 months

Friday 26th February 2010
quotequote all
BliarOut said:
Right, I've been brushing up on my knowledge of css so I can better understand for the next time I hit a bugette.

Is my understanding of the following correct?

A div applies to a block level element and is invoked with a style= tag.

A span applies to an inline element and is invoked with a class= tag.

The css may contain instructions that relate to both inline and block elements, ie. font size and colour.

In the actual css :

A class tag begins with a dot.

An ID is unique within an HTML document and is defined with a hash.
span and div both take the same parameters

class="foobar" allows you to refer to .foobar {} in the css
style="float: left; border: 1px ..." allows you to style an individual element, eg. for one offs which don't warrant their own class

BliarOut

Original Poster:

72,863 posts

263 months

Friday 26th February 2010
quotequote all
Just figured that one paperbag

So <div class="myClass"></div>

and <span class="myClass"></span>

and <span style="color: red;"></span>

are identical when the css contains

.{myClass
color: red;
}

and I would end up with an area of red text until I overrode it?

evenflow

8,851 posts

306 months

Friday 26th February 2010
quotequote all
BliarOut said:
Just figured that one paperbag

So <div class="myClass"></div>

and <span class="myClass"></span>

and <span style="color: red;"></span>

are identical when the css contains

.{myClass
color: red;
}

and I would end up with an area of red text until I overrode it?
Yes.

If the css read:

.myClass {
color:red;
}

smile

There are certain rules around when to use spans and divs (span spans objects, divs are divisions IIRC) but essentially the same.

evenflow

8,851 posts

306 months

Friday 26th February 2010
quotequote all
...or if there was a section of the page that was unique, sometimes it's better to use id instead of class e.g:

<div id="myID">This is some text</div>

then the css:

{{{ #myID {
color:red;
}
}}}

^ Please ignore {{{ above, it was formatting the hash to the number 1 confused

You should only use an id once in a page, but you can reference a class as much as you like.


Edited by evenflow on Friday 26th February 16:53

BliarOut

Original Poster:

72,863 posts

263 months

Friday 26th February 2010
quotequote all
Spans for inline elements and divs for block elements biggrin I'm getting the hang of this now... smash