Full image not getting displayed, getting covered by body content at bottom

I am attaching screenshots of the header image of my site, as viewed in my localhost and the IE and firefox browsers.
You will see that there is a space covering the bottom of the header image when the site is viewed in IE or Firefox. I think it is the body extending over the header, as indicated by the margin line of the left and right columns which are extending upwards. Why is this happening? How is it that everything is fine when the site is viewed on the localhost?

Given below is the code of my index page.

 
<!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>
<title>Higher Education - UK</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="jppp UK Guide Higher Studies" />
<meta name="keywords" content="UK guide higher studies ucas register apply clearing" />
 
<style type="text/css">
 
/* 3 col fluid layout CSS Document */
/* mac hide\\*/
html, body {
 height:100%;
 padding:0;
 margin:0;
}
/* end hide*/
body {
 background:#fff;
 color: #000;
}
#outer {
 margin:0 20%;
 background:#fff;
 border-left:1px solid #000000;
 border-right:1px solid #000000;
 color: #000000;
 position:relative;
 min-height:100%;
 z-index:2;
}
* html #outer {
 height:100%;
} /*IE treats height as min-height anyway*/
#inner {
 width:100%;/*needed to fix ies bad handling of widths with percentages*/
}
#header {
 background: url(images/ukheader.gif) center no-repeat;
 border-top:1px solid #000;
 border-bottom:1px solid #000;
 color: #000000;
 margin-left:-34%;
 margin-right:-33.6%;
        margin-bottom:-3px;
 position:relative;
 min-height:150px;
        margin-bottom:-3px;
}
* html #header {
 height:1px;
}
#left {
 position:relative;/*ie needs this to show float */
 width:32.5%;
 float:left;
 margin-left:-32.5%;/*must be same as width */
}
#right {
 position:relative;/*ie needs this to show float */
 width:32%;
 float:right;
 margin-right:-32%;/*must be same as width */
 margin-left:1px;
}
#footer {
 width:100%;
 clear:both;
 height:50px;
 border-top:1px solid #000;
 border-bottom:1px solid #000;
 background-color: #406700;
 color: #ffffff;
 text-align:center;
 margin-top:-52px;/* drag footer back into page*/
 position:relative;
 z-index:3;
}
* html #footer {/*only ie gets this style*/
 \\height:52px;/* for ie5 */
 he\\ight:50px;/* for ie6 */
}
#clearfooter {
 clear:both;
 height:52px;
}/*needed to make room for footer*/
h1, h2, p {
 margin:0 0 .5em;
 padding:0 10px;
}
/* mac hide\\*/
* html #centrecontent {
 height:1%;
}/* combat IE's 3 pixel jog */
/* end hide*/
 
/* safari and opera initial 100% height fix */
html >body #minHeight {
 float:left;
 width:0px;
 height:100%;
 margin-bottom:-52px;
}
</style>
</head>
<body>
<div id="minHeight"></div>
<div id="outer">
 <div id="inner">
  <div id="header">
<p>&nbsp;</p>
</div>
  <div id="left">
<p>&nbsp;</p><p>&nbsp;</p>
   <p><a href='https://apply2.ucas.com/appreg2010/SecurityServlet' target='_new'>Register/Apply</a></p>
<p><a href='http://www.ucas.ac.uk/students/coursesearch/' target='_new'>Course Search</a></p>
<p><a href='https://track.ucas.com/ucastrack/Login.jsp' target='_new'>Track</a></p>
<p><a href='http://www.thecompleteuniversityguide.co.uk/single.htm?ipg=6736' target='_new'>Clearing</a></p>
<p><a href='http://www.ucas.ac.uk/' target='_new'>UCAS</a></p>
  </div>
  <div id="right">
  <p>&nbsp;</p> 
  </div>
  <div id="centrecontent">
   <!--centre content goes here -->
<h2>An insight into the UK admission process</h2>
<p>Have you just finished school and are you looking to do your undergraduate studies in UK? </p>
<p>Rest of the content.Rest of the contentRest of the contentRest of the contentRest of the contentRest of the contentRest of the contentRest of the contentRest of the 
contentRest of the contentRest of the contentRest of the contentRest of the contentRest of the content</p>
 
</div>
  <div id="clearfooter"></div>
  <!-- to clear footer -->
 </div>
</div>
<!-- end outer div -->
<div id="footer">
 <p>Site created by jppp - All rights reserved - 
    <a href="http://validator.w3.org/check?uri=referer"><img
        src="http://www.w3.org/Icons/valid-xhtml10"
        alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
  </p>
 
</div>
</body>
</html>

Hi,

I can’t see a gap in the code you posted above. I’ds need to see the real page to debug further.

I’m guessing that it’s probably a collapsing margin issue.

For testing only add *{margin:0;padding:0} and then see if the gap is gone. If so then look at the top and bottom margins of the elements after the header and any in the header also and remove the margins.

A top margin on an element in the main content will move the whole maincontent away from the header as the margin will collapse to the parent and the whole parent is moved.

If you have an image in the header then make sure it is set to display:block or a gap will appear underneath.

If none of the above help then post a link or post some code that shows the problem more clearly:)

Did you mean that I should add add margin:0;padding:0 to the header? I tried that and the whole header image gets reduced to the width of the center column.
I tried adding display:block along with the margin:0 and padding:0 features to the header style. But that is not making any difference. I do not know if as a newbie, I have tried out the methods you mentioned in your thread in exactly the same way that you wanted me to or whether I made any mistake while doing so.

This is how I changed my header style.

Original style

 
 
#header {
 background: url(images/ukheader.gif) center no-repeat;
      border-top:1px solid #000;
 border-bottom:1px solid #000;
 color: #000000;
 margin-left:-34%;
 margin-right:-33.6%;
        margin-bottom:-3px;
 position:relative;
        min-height:150px;
        margin-bottom:-3px;
        display:block;
}
* html #header {
 height:1px;
  }      

Changed style

 
#header {
 background: url(images/ukheader.gif) center no-repeat;
        display:block;
 border-top:1px solid #000;
 border-bottom:1px solid #000;
 color: #000000;
 margin-left:-34%;
 margin-right:-33.6%;
        margin-bottom:-3px;
 position:relative;
        min-height:150px;
        margin-bottom:-3px;
        display:block;
}
* html #header {
 height:1px;
        margin:0;
        padding:0;
}

I’ds need to see the real page to debug further.

I had attached screenshots of the real page as well as the page which could be seen on the local host as I thought that giving a link to the real page is against the rules of the forum. Am I allowed to give a link to the real page? It is here.

post some code that shows the problem more clearly.

Again, I think I have posted the full code of the page which I created. Or am I missing something as a newbie? Thanks in advance for any advice.

No, it is added globally to all elements using the universal selector (*)


* {margin:0;padding:0}

That’s not the issue anyway as I can see your page now :slight_smile: (It is ok to post links when it’s a question about debugging the code. However remember that whatever you post will be visible to search engines.)

There is nothing wrong with the header and it is the correct size - 150px.

The problem is that your image is 150px high but only a solid colour for about 130px and then transparent at the top and bottom which lets the background show through.

Just add a background colour to the header and you will see what I mean.


#header {
    background:[B]red[/B] url(http://www.priyavarier.com/NewSubdomainFolder/images/ukheader.gif) center no-repeat;
}

Change the image to one that fits or add a background colour if you want that space around it (white as in your example) .


#header {
    background:[B]#fff[/B] url(http://www.priyavarier.com/NewSubdomainFolder/images/ukheader.gif) center no-repeat;


Thank you so much. I think this happened because I had used the feather tool in photoshop, thereby creating some transparent space around the image. I now created a new image with a height of 150 px and it is working.

But I have a doubt. Why did the background not show through when I tested my page on the local host? I have WAMP installed on my PC which I use to test my pages locally.