Results 1 to 6 of 6

Thread: <h1> tag causes Horizontal Spaces Between <DIV> in Firefox but not IE7

  1. #1
    Join Date
    Jun 2008
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default <h1> tag causes Horizontal Spaces Between <DIV> in Firefox but not IE7

    Hello,

    I've have spent way, way too much time trying to figure this out have posted on various forums with no responses at all, and just can't find a solution. I'm about to go back to using Tables for this layout.

    I am trying to put header text within my page header DIV and it keeps putting empty padding/spaces between the page header and my navigation bar DIV.

    Of course it works in IE7 but not in FireFox so I figure I'm doing something wrong when it doesn't work in FireFox. Can someone take a look my code and see what the heck I might be doing wrong?
    I've tried doing this just by defining it as a <p> instead of an <h1> and I get the same problem.

    Any insight is much appreciated!

    Here is a link to the site as it stands. Like I said, it works in IE7 but not in Firefox.
    http://www.stickpeopleproductions.co...ete/index.html

    Here is my code:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Whole Athlete</title>
    <style type="text/css">
    body {
    	margin: 0; padding-top: 6px;
    	text-align: center;
    	background-color: #000000;
    	}
    #container {
    	width: 971px;
    	padding: 0;
    	margin: 0 auto 0 auto; /* look at mini article on center page 5 if css slicing */
    	text-align: left;
    	}
    #header {
    	height: 103px;
    	padding: 0;
    	margin: 0;
    	background-color: #3366cc; 
    	background-image:url('http://www.stickpeopleproductions.com/WholeAthlete/assets/graphics/wa_header.jpg'); 
    	}
    #NavBar {
    	height: 28px;
    	padding: 0;
    	margin: 0;
    	background-color:#CCCCCC;
    	background-image:url('http://www.stickpeopleproductions.com/WholeAthlete/assets/graphics/NavGray.gif');
    	}
    #PageHdr {
    	height: 55px;
    	width: 971px;
    	padding: 0;
    	background-color: #3366cc;
    	background-image:url('http://www.stickpeopleproductions.com/WholeAthlete/assets/graphics/PageHdrBg.jpg');
    	background-repeat: no-repeat;
    	}
    
    #PageHdr h1 {
    	padding: 0;
    	font-family: Arial, Verdana,  Helvetica, sans-serif;
    	font-size: 24px;
    	margin-left: 24px;
    	line-height: 24px;
    	color: #000066;
    	}	
    
    #Login {
    	position: relative;
    	left: 867px;
    	top: 35px;
    	}
    	
    #Content {
        background-image:url('http://www.stickpeopleproductions.com/WholeAthlete/assets/graphics/BodyFadeBg.jpg');
    	background-repeat:repeat-y;
    	}
    	
    #Sponsors {
    	height: 80px;
    	background-color: #ffffff;
    	}
    	
    #PageBtmBg {
    	background-image:url('http://www.stickpeopleproductions.com/WholeAthlete/assets/graphics/PageBtmBg.gif');
    	background-repeat:no-repeat;
    	height: 7px;
    	}
    #Footer {
    	background-color: #000000;
    	font-size: 10px;
    	color: #ffffff;
    	text-align:left;
    	padding-top:6px;
    }
    </style>
    </head>
    
    <body>
    <div id="container">
    <div id="header"><img id="Login" src="http://www.stickpeopleproductions.com/WholeAthlete/assets/graphics/login.gif" alt="Whole Athlete Login" /></div>
    <div id="NavBar">&nbsp;</div>
    <div id="PageHdr"><h1>The Whole Athlete approach</h1></div>
    <div id="Content">
    This is a test<br />
    This is a test<br />
    This is a test<br />
    This is a test<br />
    This is a test<br />
    This is a test<br />
    This is a test<br />
    This is a test<br />
    This is a test<br />
    This is a test<br />
    </div>
    <div id="Sponsors"></div>
    <div id="PageBtmBg"></div>
    <div id="Footer">&reg;2008 Whole Athlete all rights reserved.</div>
    </div>
    </body>
    </html>
    I appreciate any help on this...

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    See if adding the highlighted helps:
    Code:
    #PageHdr h1 {
    	padding: 0;
    	margin-top:0px;
    	font-family: Arial, Verdana,  Helvetica, sans-serif;
    	font-size: 24px;
    	margin-left: 24px;
    	line-height: 24px;
    	color: #000066;
    	}
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Feb 2006
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Hi there,
    I am not sure why you have your styles in your HTML page AND your CSS sheet?

  4. #4
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    @Harry
    The OP doesn't have an external stylesheet. They're declaring all their styles within the HTML <head>. There is nothing wrong with doing this. It's just that it's sometimes neater to move the styles to an external page.

    @feeble_fuel
    The <h1> tag has some default margins and padding associated with it. Different browsers will treat is differently. As rangana suggested, if you want consisted rendering across browsers, explictly declare how much margin and/or padding you want. If you want everything to be flush (i.e. no margin/padding), use:

    Code:
    margin:0;
    padding:0;
    It looks like you only want left padding, so perhaps something like this is more appropriate:

    Code:
    margin:0 0 0 24px;
    padding:0;
    What's the purpose of the line-height declaration? You _probably_ don't need that.

  5. #5
    Join Date
    Jun 2008
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the suggestions and solution. I added the margins in as suggested and it worked! Thank you!

    I had the height in there hoping that would take care of the positioning of the text within the div, but it was useless and have taken it out.

    To answer the question of why the css is within my html doc is simply for your convenience in the forum so you can see the css and code that I'm using. It allows you to do a simple copy and paste to your computer to test out without having to extract it from an external style sheet.

    When I go to production, I will move it to an external style sheet for the clean look.

    Thanks everyone for the help!

    Cheers,

    Kelly

  6. #6
    Join Date
    Feb 2006
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by Medyman View Post
    @Harry
    The OP doesn't have an external stylesheet. They're declaring all their styles within the HTML <head>. There is nothing wrong with doing this. It's just that it's sometimes neater to move the styles to an external page.
    Ooops sorry - I viewed the CSS and have done so again and now see it is embedded sorry about that. *my* confusion!

    Harry

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •