W3C home > Mailing lists > Public > www-style@w3.org > July 1996

Re: CSS and Eccentric Poems.

From: Bert Bos <Bert.Bos@sophia.inria.fr>
Date: Wed, 3 Jul 1996 12:23:52 +0200 (MET DST)
Message-Id: <199607031023.MAA05345@mygale.inria.fr>
To: Carl Johan Berglund <f92-cbe@nada.kth.se>
Cc: www-style@w3.org
Carl Johan Berglund writes:
 > Bert Bos wrote:
 > > This spacing is indeed too irregular for CSS1. Some sort of mark-up
 > > has to be in the HTML; a <SPAN> seems logical, but a <BR> would work
 > > as well, and is shorter to type:-)
 > > 
 > >     <style>
 > >     br.gap1 { display: inline; width: 7em }
 > >     br.gap2 { display: inline; width: 5em }
 > >     </style>
 > > 
 > >     <p>in Just-<br>
 > >     spring<br class=gap1>when the world is mud-<br>
 > >     luscious the little<br>
 > >     lame baloonman
 > > 
 > >     <p>whistles<br class=gap2>far<br class=gap2>and wee
 > The problem here is that <br> is not a container--there is
 > no </br> tag, so there is no content of the <br> that can
 > be styled in any way. But setting the space between paragraphs
 > to zero (as proposed) means you can do it with <p>.

Whether or not <BR> has content is not important for CSS. <IMG>
doesn't have content either. Neither does the sequence
`<EM></EM>'. For CSS an element is just an element; it has a name,
optionally an ID, zero or more attributes, and zero or more characters
of content. (In other words: CSS deals with the abstract document
tree, not with the incidental markup.)

If I interpreted the original poster's code correctly, the poem is
supposed to look approximately like this:

    in Just-
    spring       when the world is mud-
    luscious the little
    lame baloonman

    whistles     far     and wee

Here are two alternative ways of expressing the layout of the same
poem. This time using the STYLE attribute only, to keep the
information local. Which is preferred depends on one's taste:

    <p>in Just-<br>
    spring<br style="display:inline;width:7em">when the world is mud-<br>
    luscious the little<br>
    lame baloonman

    <p>whistles<br style="display:inline;width:5em">far<br
    style="display:inline;width:5em">and wee


    <p>in Just-<br>
    spring<span style="word-spacing:7em"> </span>when the world is mud-<br>
    luscious the little<br>
    lame baloonman

    <p>whistles<span style="word-spacing:5em">
     </span>far<span style="word-spacing:5em">
     </span>and wee

and there are many other ways as well.

The CSS1 draft notes that changing a block element to an inline
element, as I did for <BR>, is dangerous, since the first generation
of browsers may have that property hard-coded. Still, it should work

The last example with <SPAN> shouldn't be problem. The whitespace
inside the element (note that I deliberately put extra, collapsible
whitespace characters there) represents a word separator, which is
then stretched to 5em.

  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/pub/WWW/People/Bos/                      INRIA/W3C
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 93 65 77 71                 06902 Sophia Antipolis Cedex, France
Received on Wednesday, 3 July 1996 06:24:00 UTC

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