width property

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I read a post were a guy had trouble because Firefox would not play ball
with the width property on a non-replaced inline element, so the code below
did not work as the OP thought it would .
<span style="width:100px;background-color:Red;">text</span>
<span style="width:100px;background-color:Green;">test</span>
<span style="width:100px;background-color:Blue;">test</span>

The answer given was:
"And, since you haven't altered its display, the span is a non-replaced
inline element....."

Could someone explain what sort of thing you could do to a span to alter its
display and thereby turn it into a replaced inline element (which according
to logic would respond to the width property). Just getting a bit lost with
the terminology.
thanks in advance

Re: width property

David Graham wrote:

Quoted text here. Click to load it

You can't turn a span into a replaced inline element. Such elements are
things like <input> and <img>. You could set display: block to turn the
span into a (from a CSS POV) block element, but then you would get all the
other effects of being displayed like a block.

David Dorward       <http://blog.dorward.me.uk/ <http://dorward.me.uk/
                     Home is where the ~/.bashrc is

Re: width property

Quoted text here. Click to load it

You can't "turn it into a replaced inline element". You can set the CSS
display property to "block" (display:block), or to "inline-block"
(display:inline-block), the width property applies to both. The
"inline-block" value is supported by IE5.5+, Opera 7+, recent iCabs and
recent KHTML based browsers (Safari, Konqueror). Inline-block is *not*
supported by Gecko based browsers (Firefox, Mozilla suite).


Site Timeline