Re: display property

On Fri, 27 Jun 2003, Brian V Bonini wrote:
>
> On Thu, 2003-06-26 at 14:31, Ian Hickson wrote:
>> The user agent stylesheet is not the "default". The default is given by
>> the initial value of the property, which in the case of 'display', is
>> indeed 'inline'.

Incidentally, we (the working group) briefly discussed this yesterday, and
our conclusion was that the term "default value" is meaningless. (The UA
stylesheet can be thought of as the "default stylesheet", but it is not
giving "default property values", merely the default stylesheet.)


> But are not certain elements block by default, i.e., div, p. Or do they
> directly rely on the default state of the display property?

Neither of those questions really mean anything in a CSS context.

Certain elements, such as div and p, are typically styled as

   p, div { display: block; }

...in the UA's stylesheet. For example:

   http://lxr.mozilla.org/seamonkey/source/layout/html/document/src/html.css#40

...is Mozilla's. Others, such as span and em, are rendered inline. Since
the initial value of 'display' is 'inline', nothing needs to be done for
those, so I guess you could say they rely on the initial value.


> SO what is the difference between block as it applies to the display
> property and block level as it applies to html elements?

The two terms are unrelated.

The terms block-level and inline-level in HTML are defined here:
   http://www.w3.org/TR/html4/struct/global.html#h-7.5.3

The same terms in CSS are defined here:
   http://www.w3.org/TR/REC-CSS2/visuren.html#box-gen

Basically, in HTML, the terms refer to the structure (block level elements
can contain inline level elements but not vice versa), whereas in CSS the
terms refer to how the boxes will be rendered (block level elements stack
vertically, inline level elements are placed side by side in lines).


> 7.5.3 Block-level and inline elements
>
> Formatting
>         By default, block-level elements are formatted differently than
>         inline elements. Generally, block-level elements begin on new
>         lines, inline elements do not. For information about white
>         space, line breaks, and block formatting, please consult the
>         section on text.
>
> Now if this is the default behavior of block-level elements such as p or
> div independent of css then display: block; is indeed redundant no? Or
> is this assuming the UA internal styles will define this by default.

That is the HTML spec giving rough guidelines for formatting conventions.
In CSS user agents, those guidelines are followed by having relevant rules
in the UA stylesheet.

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 27 June 2003 10:19:36 UTC