David Boddie wrote:

> Alan Gresley wrote:
>> It would appear that all those widths are causing IE6 a lot of trouble. 
>> None of which are really needed for any browser. 

> Thanks Alan & Amy for all your help. I've snagged the code, so you 
> can take it down now if you like. Even though I use CSS a lot I guess 
> I'm still a novice at dotting all the 'i's and crossing all the 't's.
> 
> This will help me a lot. I've been training myself to setting widths 
> for everything, just to be precise, and the newer browsers take it 
> all in stride. I guess I keep forgetting that the older browsers just 
> choke on all my nitpickiness... :D
> 
> I'll go over this code and try to figure out my mistakes. And I'll 
> probably submit it again... everyone will get tired of me submitting...
> 
> Boddie

Hi Boddie

I use to do the same with the widths. Consider the difference between a static 
block element and static inline element

A static block element such as a <div>, <ul> and <li> will expand the full 
width of it's containing block [1], so giving the block element a width of 100% 
changes nothing, but with IE the element gains hasLayout and this depending on 
the layout can render in a myriad of ways. This changes when the element is 
floated or positioned where it will now shrink wrap it's contents. So when we 
use auto for a width it is because we are overruling a width that is already 
applied to the same element. Example.

#nav li {width:200px}
#nav li li {width:auto}

A inline (non-replaced) element such as an <a> will be as wide as the anonymous 
boxes [2] it contains so we make it behave as a block element such as a <div> 
by declaring

#nav li a {display:block}

so now it is as wide as it's containing block which is the <li>.

I think it's common when learning CSS to cover all bases in this fashion by 
giving every element a width %, em, px, auto or slapping position:relative on 
every major div and then further along in our learning curve sending IE buggy 
by inducing hasLayout everywhere. Reading the specs bit by bit and testing by 
removing this and that helps to come to grasp with how CSS works.

Keep on submitting, I learned a bit myself while working with your page.

[1] <http://www.w3.org/TR/CSS21/visudet.html#blockwidth>
[2] <http://www.w3.org/TR/CSS21/visuren.html#anonymous>

Kind Regards, Alan

<http://css-class.com/>

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to