we can ensure that the positioned content elements will always appear closest to the viewer, despite the fact that the navigation comes after the content in the source.
#content {
position: relative;
z-index: 2;
}
#nav_main {
position: absolute;
z-index: 1;
}
Now applying absolute positioning with a negative top value to the
and a higher z-index value than the following
ensures that the header sits not only on top of the navigation but also the styled paragraph which follows it.
h2 {
position: absolute;
z-index: 200;
top: -n;
}
h2+p {
position: absolute;
z-index: 100;
margin-top: -n;
padding-top: n;
}
Dissecting part of Karova.com
You can see the full effect in the wild on the Karova.com site.
Have a great holiday season!",2005,Andy Clarke,andyclarke,2005-12-16T00:00:00+00:00,https://24ways.org/2005/zs-not-dead-baby-zs-not-dead/,design
329,Broader Border Corners,"A note from the editors: Since this article was written the CSS border-radius property has become widely supported in browsers. It should be preferred to this image technique.
A quick and easy recipe for turning those single-pixel borders that the kids love so much into into something a little less right-angled.
Here’s the principle: We have a box with a one-pixel wide border around it. Inside that box is another box that has a little rounded-corner background image sitting snugly in one of its corners. The inner-box is then nudged out a bit so that it’s actually sitting on top of the outer box. If it’s all done properly, that little background image can mask the hard right angle of the default border of the outer-box, giving the impression that it actually has a rounded corner.
Take An Image, Finely Chopped
Add A Sprinkle of Markup
Lorem ipsum etc. etc. etc.
Throw In A Dollop of CSS
#content {
border: 1px solid #c03;
}
#content p {
background: url(corner.gif) top left no-repeat;
position: relative;
left: -1px;
top: -1px;
padding: 1em;
margin: 0;
}
Bubblin’ Hot
The content div has a one-pixel wide red border around it.
The paragraph is given a single instance of the background image, created to look like a one-pixel wide arc.
The paragraph is shunted outside of the box – back one pixel and up one pixel – so that it is sitting over the div’s border. The white area of the image covers up that part of the border’s corner, and the arc meets up with the top and left border.
Because, in this example, we’re applying a background image to a paragraph, its top margin needs to be zeroed so that it starts at the top of its container.
Et voilà. Bon appétit.
Extra Toppings
If you want to apply a curve to each one of the corners and you run out of meaningful markup to hook the background images on to, throw some spans or divs in the mix (there’s nothing wrong with this if that’s the effect you truly want – they don’t hurt anybody) or use some nifty DOM Scripting to put the scaffolding in for you.
Note that if you’ve got more than one of these relative corners, you will need to compensate for the starting position of each box which is nested in an already nudged parent.
You’re not limited to one pixel wide, rounded corners – the same principles apply to thicker borders, or corners with different shapes.",2005,Patrick Griffiths,patrickgriffiths,2005-12-14T00:00:00+00:00,https://24ways.org/2005/broader-border-corners/,design
330,An Explanation of Ems,"Ems are so-called because they are thought to approximate the size of an uppercase letter M (and so are pronounced emm), although 1em is actually significantly larger than this. The typographer Robert Bringhurst describes the em thus:
The em is a sliding measure. One em is a distance equal to the type size. In 6 point type, an em is 6 points; in 12 point type an em is 12 points and in 60 point type an em is 60 points. Thus a one em space is proportionately the same in any size.
To illustrate this principle in terms of CSS, consider these styles:
#box1 {
font-size: 12px;
width: 1em;
height: 1em;
border:1px solid black;
}
#box2 {
font-size: 60px;
width: 1em;
height: 1em;
border: 1px solid black;
}
These styles will render like:
M
and
M
Note that both boxes have a height and width of 1em but because they have different font sizes, one box is bigger than the other. Box 1 has a font-size of 12px so its width and height is also 12px; similarly the text of box 2 is set to 60px and so its width and height are also 60px.",2005,Richard Rutter,richardrutter,2005-12-02T00:00:00+00:00,https://24ways.org/2005/an-explanation-of-ems/,design