Line height itself can be a bit tricky, yeah. Somewhere I have an old bookmark to a post by David Baron about inline elements, with some drawings, which at the time I found it I thought it was very useful.
Ah, found it: http://dbaron.org/css/2000/01/dibm
This post is from when people were discussing what inline elements and line-height and font-size etc should do in browsers, which is why the article is old. It’s still useful.
Usually we set line-height to something larger than the pixel height of the character. For example, a common setup is font: 12px/15px fontname fontname fontfamily; We usually don’t want the tops of the letters on one line to touch the bottoms of the letters in the line above.
Agreed.
I wouldn’t set p margins to 0, but if you want everyone to show the same amount of margin, you can simply set something and you get teh same effect: they’re all the same and you’ll know how large they’ll be anywhere.
I personally tend to set margins on p’s to 0 0 something 0; that is, only a bottom margin.
I’m also going to (of course) agree with ralph about not setting up page layouts with absolute positioning. However, the practical solution to not using absolute positioning means a bunch of time and technique learning CSS positioning, which isn’t going to fix your immediate goal.
I’d say, if you’re planning on doing more of this sort of thing, you need to learn CSS for positioning, because every screen is different and every device is different and every browser/user agent is different, and absolute positioning is very brittle (it can’t adjust to these things). If this is a one-time thing, then just go with what you have, but I’d set the top position of the lower box even a bit further down just to compensate a bit more for any browser adding a bit of height to the first box for any reason.
Ralph, Everything I have been reading on line over the years has praised pixel positioning as the way to go.
My first impression there is perhaps that’s either old material (before modern positioning methods actually worked, which once upon a time, they did not), or more geared for print people. In print, you know exactly your sizes and dimensions of everything, and pixel-perfection to any machine that exactly agrees with your definition of a pixel can be assumed to show you exactly what you tell it. Browsers and computer screens don’t fall under that category today, however.
The place I see the most absolute positioning nowadays is coming from the Javascript world. Quite often I am removing it from plugins our shops use and replacing them with CSS for better control based on what’s happening on the screen. Abso-po is also quite common in popups/lightboxes/overlays, dropdown menus (the sub menus), and clever tricks like Gilder-Levin image replacement (which I often use as well). It has its place and is very useful. But it’s a tool best used when you know its limitations.