HTML block/inline != CSS block/inline (was Re: UL - Block or Inline?)

From: Dave  J Woolley <david.woolley@bts.co.uk>
Date: Wed, Jan 31, 2001, 11:35 AM

>> From: pdf@bizfon.com [SMTP:pdf@bizfon.com]
>>
>> Am I looking in the wrong place?
> [DJW:]
> The definitive place is the DTD, taken in this
> case from the HTML 4.01 specification (PDF version) -
> <http://www.w3.org/TR/html4/sgml/dtd.html> for the HTML
> verson:
>
> <!ENTITY % list "UL | OL">
> ...
>
>
> <!ENTITY % block
> "P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
>  BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">
>
>  [DJW:]  It's defnitely a block element.

An _HTML_ block element to be specific.


>> The reason I ask (off topic) is because I notice strange behavior (in IE
>> and
>> Netscape) with lists when there is an item floated to the left of the
>> list, and
>> I wanted to get a better understanding of where the list marker (the disc,
>> etc.)
>> fits into the picture, so that I might find a work around for existing
>> agents
>> that display it incorrectly.
>  [DJW:]
>  You might want to note that list items are treated
>  as a special case in CSS, i.e. neither block nor inline.
> [DJW:]


We really need a FAQ for this list, for this question/misunderstanding seems
to come up perhaps every six months.

HTML block vs. inline

 is not the same as

CSS display:block, display:inline


HTML's notion of block vs. inline is essentially that of containment rules.
E.g. what elements can be nested inside what other elements.

CSS's notion of block-level or inline-level display is purely
layout/presentation related, and has nothing to do with element nesting or
containment.

Now, typically the _default_ presentation of HTML block elements is
display:block, and the default presentation of HTML inline elements is
display:inline.  This just serves to further the confusion of course.

However, any HTML block element can be styled to be "display:inline", and
any HTML inline element can be styled to be "display:block".


Tantek

----------------------------------------------------------------------------
Are we beginning to see the possibilities here?    www.microsoft.com/mac/ie/

Received on Wednesday, 31 January 2001 14:59:02 UTC