W3C home > Mailing lists > Public > www-style@w3.org > February 2000

Re: Shrinkwrap

From: Eric A. Meyer <emeyer@sr71.lit.cwru.edu>
Date: Mon, 28 Feb 2000 08:51:13 -0500
Message-Id: <v04210100b4e02b1a6383@[]>
To: www-style@w3.org
>There doesn't seem to be any way to shrink-wrap the width of a block
>element; at least, I can't find any in the CSS2 spec.

   No, there isn't.

>Setting width and margins both to auto makes width=100% and
>margins=0--which I think defeats the purpose of setting both the width
>and margins to "auto". Is there any specific reason for this?

   Because it's the most certain case.  Assume for a moment that setting
all three to 'auto' would cause "shrinkwrap" effects.  How does a user
agent decide the shrinkwrap width in a changeable environment?  For
example, paragraph text which is half a line long on your desktop system's
monitor might be four lines long on my PDA, or even 90% of a line on my
desktop system.  For that matter, changing the width of your browser window
on one system could radically alter the situation.
   Now, if what you want is a box which just surrounds the text of a
heading (for example), you could do it by setting styles on an inline
element which surrounds text, like this:

   H1 SPAN {border: 1px solid maroon; background: yellow;}

   <H1><SPAN>This is the text</SPAN></H1>

This is, however, a rude hack around the problem which runs totally counter
to the general aims of CSS, and if you push this too far it won't work very
well in many user agents anyway.
   So anyway, one assumes that you had a reason for wanting
"shrinkwrapping."  Could you describe it in more detail?  Maybe it will
provide us the beginnings of a path to adding such behavior to the

Eric A. Meyer  -  eam3@po.cwru.edu  -  http://www.cwru.edu/home/eam3.html
 Editor, Style Sheets Reference Guide  http://style.webreview.com/
 Coordinator, W3C CSS Test Suite       http://www.w3.org/Style/CSS/Test/
 Member, WSP CSS Technical Committee   http://www.webstandards.org/
Received on Monday, 28 February 2000 08:51:26 UTC

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