CSS Epiphany
Wherein Robert smacks himself in the forhead
and says “D‘oh!”
I realized two fundamental and very simple CSS
features today, which I had somehow completely misunderstood or not noticed
before. First was the the way in which I could embed <span></span>
inside structural markup in order to get a handle on the contents. An example is
the simple:
h1 {text-align:
center; font-size:1em;}
h1 span {color:
#0f0; font-size: large; background:#040; padding:
6px}
<h1><span>something</span></h1>
in order to put a color behind
the <h1> without it extending all the way across the screen.
D‘oh!
The other is bleeding
obvious: changing a block container like a <div> to
”position:relative” allows the contents of that container to be
positioned absolutely in relation to that container. It‘s in black and
white, why didn’t I get that before? I‘ll knock up a test journal
style using that, just for my own reference.
Posted: Tue - July 29, 2003 at 09:39 PM
The Occasional Masthead
Technology Email Comments