Forum Moderators: not2easy

Message Too Old, No Replies

Inline Elements & the Width Property

nestcape bug or non standard?

         

Humpo

2:23 pm on Jun 11, 2003 (gmt 0)

10+ Year Member



Netscape seems to be ignoring the width of the span
e.g

<span style="width:400px;background-color:red;">abcd</span>

works for IE and Opera.

Is it a bug with Netscape or is width a non standard property of span(hope that makes sense)?

Is there a workaround?

thanks

universalis

2:48 pm on Jun 11, 2003 (gmt 0)

10+ Year Member



<span> is an inline element, so it would be inappropriate to in this particular context. You should try:

<div style="width:400px;background-color:red;">abcd</div>

drbrain

6:24 pm on Jun 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, the bug is with Opera and IE, from CSS2 Visual formatting model details:


width [...]
Applies to: all elements but non-replaced inline elements, table rows, and row groups

10.2 Content width: the 'width' property [w3.org]

WibbleWobble

9:05 am on Jun 12, 2003 (gmt 0)

10+ Year Member



You could always set display:block; if you're prepared for the linebreak after the span content. Universalis is correct though, its not really the best use of the span tag.