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

width of content+padding versus border+margin

From: Roger Watt <rwwatt@ist.uwaterloo.ca>
Date: Fri, 15 Dec 2000 11:43:15 -0500 (EST)
To: www-style@w3.org
Message-ID: <Pine.SOL.4.21.0012151128260.1204-100000@ist.uwaterloo.ca>
I'm trying to create H2 output such that the content appears with a
background colour that occupies an area only moderately larger than the
content itself. So I started with

   H2 { background: #066; padding: 3pt; }

With both NN6 and IE5, what results is a background that extends across
the full width of the browser's window. So I wondered if perhaps I could
influence the left/content/right equality

     width = margin+border+padding + content + padding+border+margin 

by trying

   H2 { background: #066; padding: 3pt !important; }

but that didn't do the trick either.

Is there something that my repeated readings of the spec have failed to
detect, or is there simply no way to do this?

(PS: I get the desired content/background effect by declaring the H2 to be
"inline" instead of "block", but I want a block-mode heading.)
Received on Friday, 15 December 2000 11:43:21 GMT

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