W3C home > Mailing lists > Public > www-style@w3.org > April 2005

Re: Wrapping paragraphs around blocks

From: Bert Bos <bert@w3.org>
Date: Fri, 1 Apr 2005 15:56:04 +0200
To: www-style@w3.org
Message-Id: <200504011556.04972.bert@w3.org>

On Friday 25 March 2005 20:43, Barry wrote:
> Hi list,
>
> It's not valid to put a block-level element within a paragraph, so I
> was forced to put text that I wanted wrapped around a list (the green
> list at http://www.polisource.com/consumer-protection.shtml ) in a
> <div> instead of a <p>. That removes the semantics that a paragraph
> tag would represent, so it's not a good solution. I could use an
> image, but then I'd have to duplicate the list in the alt text or in
> a title.
>
> What do you think about creating a property that causes two separate
> blocks, such as a div containing paragraphs and another containing a
> list, to be pulled together when rendered, so the text of the first
> block would be wrapped around the second? The second block would be
> able to be vertically and horizontally positioned and its surrounding
> white-space filled with text on the top or bottom, and if the second
> block is positioned far enough left to be in the center of the first
> block, there would be text wrapped on both sides.

I think the problem is a limitation of HTML, rather than of CSS. If you 
put the text and the list in sibling elements, the structure would be 
wrong. As you can see, CSS handles your current structure fine. It is 
HTML that forces you to use DIV, while the semantics calls for a P.

At least if I understand your example correctly, the structure you want 
is:

    <P>
      ... text text text...
      <OL>
        ... item item item...
      </OL>
      ... text text text...
    </P>

HTML4 indeed can't do this, at least not when using <P>, but the 
proposed XHTML2 can: a paragraph is allowed to contain lists, 
blockquotes and other elements, to express that they are semantically 
inside the paragraph.

So my advice is to not extend CSS, but use DIV for now and switch to 
XHTML2 later.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Friday, 1 April 2005 13:56:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:36 GMT