Re: width question

On Mon, 22 Jan 2001 15:01:51 +1100, "Lindsay Evans"
(lindsay@redsquare.com.au) wrote:
> 
> <div style="width:300; border:1px solid #ff0000;">
> 	<span style="width:100%; border:1px solid #000000;">this is some
> text</span>
> </div>
> 
> Should the black border on the <span> stretch out to 300px?

No, it shouldn't, assuming you have left the 'display' property for
span as its default ('inline').  CSS2 section 10.3.1 applies here,
and it says:

  The 'width' property does not apply. A specified value of 'auto' for
  'left', 'right', 'margin-left' or 'margin-right' becomes a computed
  value of '0'. [1]

(Also, the declaration of the 'width' property on the DIV element is
ignored since unitless numbers are not allowed for DIV and lengths are
required to have units.)

-David

[1] http://www.w3.org/TR/REC-CSS2/visudet.html#q4

L. David Baron        <URL: http://www.people.fas.harvard.edu/~dbaron/ >
Mozilla Contributor                      <URL: http://www.mozilla.org/ >
Invited Expert, W3C CSS WG          <URL: http://www.w3.org/Style/CSS/ >

Received on Sunday, 21 January 2001 23:12:02 UTC