width of content+padding versus border+margin

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 UTC