(Note: I edited the URL. Sorry about that, woops.)
Hi,
I am trying to solve an issue that is just driving me crazy. The text within <div>"navbar" and <div>"video_header" change their placement by one pixel depending on which browser you use. I am trying to get the text to be centered vertically within their divs.
Safari and Windows Firefox show them centered. Mac Firefox shows the text one pixel too high. IE7 shows the text one pixel too low.
Here I have tried setting line-height to be the same height as the parent div. I have tried using "vertical-align:middle;" but I haven't been able to get it to work. Using top padding makes the browser differences worse.
I am guessing that the problems I am facing are due to minute differences in font-height for each browser, though I am not sure how to get around this.
I personally don't use "vertical-align" -- maybe things have changed, but it never used to do what I expected it to do. Without seeing the code, I am not exactly sure what is happening. I always do a CSS Reset -- that will help with some of your frustrations, especially if you want to use conditional comments to adjust the padding to make things look nice.
Oh, please don't edit your first post, especially if the discussion gets very long, most of the time people don't check to see if a response was edited. ------ Usually to get text to align vertically you must use line-height and total-height(padding will effect this).
They must be the same. So if your height is 20px, and you want the text to be in the middle of that make the line-height of that element the same as the height. vertical-align won't work. But this should fix your problem, and guide you in the right direction.
I have tried that technique. In different browsers the slight difference in the way each browser renders font height was (and continues to be) setting the text off by 1px as I mentioned in my first post. I am wondering if there are any other techniques to correct this besides line-height? It is definitely some sort of cross-browser bug....even a hack would be appreciated at this point.
Also CSS has what is called leading. They derive this leading value from the difference between font-size and the lineheight. Half of the difference is applied to the top and bottom of the inline-element. So if the difference between the two is not an even number you won't get an even alignment.
You could always find a technique that works in all mozilla browsers, and then load a separate stylesheet for IE users. This is usually the way to fix really nit picky stuff in a short period of time.
I mean does your boss think that someone is gonna break out a ruler and see that its 1px different in FF than IE? I think you have bigger fish to fry in IE6. Like the fact that the column of videos drops below the left sidebar.