View Full Version : Line Height Discrepancy: IE vs. FF

05-08-2007, 11:35 PM
Hi, I'm a new member here. I joined up because my expertise in CSS is rather limited to say the least.

I'm currently working on a site in Dreamweaver but I am having some problems regarding line height - it differs substantially between IE7 and Firefox. Take a look for yourselves:


The first line is much lower in FF than it is in IE7. Is anyone able to offer any help?

Here's the CSS code:

(".bodytext1_headings" applies to the first line of text that I am having trouble with)

.backdrop {
horizontal-align: middle;
margin-top: -375px;
margin-left: -500px;
position: absolute;
left: 50%;
top: 50%;
.bodytext1 {
font-family: Georgia, "Times New Roman", Times, serif;
color: #FFFFFF;
margin-top: -110px;
margin-left: -317px;
position: absolute;
left: 50%;
top: 50%;
height: 279px;
width: 500px;
overflow-y: auto;
overflow-x: hidden;
font-size: 12px;
.bodytext1_headings {
font-size: 20px;
font-weight: bold;

.background {
background-color: #000000;

overflow-y: hidden;
scrollbar-base-color: #808080;
scrollbar-face-color: #808080;
scrollbar-track-color: BACKGROUND;
scrollbar-highlight-color: LIGHT;
scrollbar-3dlight-color: #808080;
scrollbar-shadow-color: DARK;
scrollbar-darkshadow-color: #808080;
scrollbar-arrow-color: #EFEFEF;

05-09-2007, 02:19 AM
The following code seems to solve your problem. I only tested it in Firefox 2.0.

p:first-child { margin-top: 0; }

This does not, however, address the fact that youíre misusing the p element. The element represents a paragraph, not a header. There are several elements intended for use as headers, such as h1, h2, h3, h4, h5, and h6, that would be more appropriate. Using elements according to their meaning is called semantics.

You may also notice that your list is missing bullets. Thatís due to errors 7, 8, 10, and 12 as listed here (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.admasu.karoo.net%2Fmbconnection%2Fmain.html). Those li elements should be contained within a ul element.

The odd character shown after ďThese include:Ē in Internet Explorer 7 is an invalid character that should be removed. Itís error 6 in the previously referenced resource. Unfortunately, you may not even be able to see the character unless you open up your document in something like Notepad++.

You may want to fix the other errors (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.admasu.karoo.net%2Fmbconnection%2Fmain.html) too.

Hereís a rewrite of your code in case youíre interested in having code thatís semantic, accessible, valid, and cross‐browser compatible. There is one cross‐browser difference: the layout is centered vertically except in Internet Explorer (where it degrades gracefully). Hereís a live copy (http://www.jsgp.us/demos/CF113809.html) and hereís the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"

<html lang="en-Latn">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Music &amp; Brand Connection</title>
<style type="text/css">
* { margin: 0; padding: 0; }
html { background: black; color: white; font: 12px Georgia, "Times New Roman", Times, serif; }
#container { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 1000px; height: 750px; margin: auto; }
h1 { position: absolute; top: 0; right: 0; left: 0; text-align: center; line-height: 261px; }
h1 img { display: block; }
#content { position: absolute; z-index: 1; top: 261px; left: 173px; width: 518px; height: 290px; overflow: auto; }
#content h2 { margin: 0.6em; font-size: 20px; }
#content p { margin: 1em; }
#content ul { list-style: inside; margin: 1em; }
#content em { font-style: normal; text-transform: capitalize; }
<!--[if IE]>
<style type="text/css">
#container { position: relative; top: auto; right: auto; bottom: auto; left: auto; margin: 0 auto; }


<div id="container">
<h1><img alt="Music &amp; Brand Connection" width="1000" height="750" src="CF113809.jpeg"></h1>
<div id="content">
<h2>Who We Are</h2>
<p>Music &amp; Brand Connection exists to provide brands and agencies that use music in their marketing strategy with expert advice on the music industry by working with <em>managers</em>, <em>labels</em>, and <em>publishers</em> on your behalf.</p>
<p>We offer all of our services on an individual project basis or as a fully integrated solution for your music properties. These include:</p>
<li>Strategic Planning</li>
<li>Relationship Brokering &amp; Management</li>
<li>Project Management &amp; Activation</li>
<li>Content Creation</li>
<p>Music &amp; Brand Connection creates and finds music properties and solutions that deliver to your requirements whether their focus is endorsement, content, or experimental.</p>


05-09-2007, 03:46 AM
I can't say enough how much I would recommend you/everyone downloading FireFox and using the extension "FireBug".:)