On Sep 26, 2009, at 11:00 PM, Alan Gresley wrote:
>> ( I would imagine 'fieldset' in B to be a block level element just
>> like 'p' in A, and 'span' in both A and B is inline element - but I
>> don't see why in A it works but in B it doesn't )
>
>
> Hello,
>
> You can not give a width to a <span> if it is treated as an inline
> element. Does this help.
>
> .first_label {
> display: block; /* Add */
(written in other words) span, by default, is an inline element [1].
'Width' (and 'height') do not apply to inline elements
<http://www.w3.org/TR/CSS21/visudet.html#propdef-width>
If you change the display value of the <span> to block (or inline-
block), then 'width' will work.
The span in your 'A' example is set to 'float:left'. By definition,
the 'float' property sets the display value to 'block'.
<http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo>
(that is why it always look ridiculous to me when I see the following
code snippet in a stylesheet:
selector {
float: left;
display:block;
}
)
[1] in HTML4.01; HTML5 has similar wording
<http://www.w3.org/TR/html401/struct/global.html#edef-SPAN>
Philippe
---
Philippe Wittenbergh
http://l-c-n.com/
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/