W3C home > Mailing lists > Public > www-style@w3.org > January 2001

Re: width question

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Sun, 21 Jan 2001 23:11:55 -0500 (EST)
Message-Id: <200101220411.XAA23820@is01.fas.harvard.edu>
To: lindsay@redsquare.com.au, www-style@w3.org
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.)


[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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:56 UTC