Forum Moderators: not2easy

Message Too Old, No Replies

100% width <span> in Mozilla

I want to stretch a <span> to the width of its enclosing <div>..

         

Warboss Alex

10:57 am on Apr 18, 2004 (gmt 0)

10+ Year Member



Hey everyone. High-level PHP's easier than this CSS lark .. (mutters..) ..

I want to stretch a <span> to the width of its enclosing <div>. In the span's class declaration, I use width:100%; which should have it stretch to whatever width of its container <div>.

In Opera and IE, this works fine. In Mozilla FireFox though, it only stretches to the end of the text between the span tags, not to the end of the <div>.

For the record, the <div> is also width:100%; ..

Anyone know a solution/workaround?

SuzyUK

1:18 pm on Apr 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<span> is an inline element so won't (or shouldn't ;)) accept a width declaration..

either replace the span with a div (a natural block element).. or add display: block; to that particular span rule in the CSS

Suzy

Warboss Alex

2:56 pm on Apr 18, 2004 (gmt 0)

10+ Year Member



Duh.

So it's another case of Mozilla getting it -right-, and everyone else getting it wrong, then?

Thanks Suzy. :)