Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

annoying little gap in IE7... 1

Status
Not open for further replies.

maxelcat

Technical User
Oct 19, 2006
79
Hi

Here is the code for a very simple page. In FF and NS and Opera I get a dark blue banner right across the page with a small link-blue box directly underneath it with no gap. Perfect.

IN IE I get a little gap between what would be the link block and the banner.

I think I am probably missing something obvious but.....where does it come from and how do I get rid of it please.

The offending page is at

and the code is below
thanks

E

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Butterfly Document Update Site</title>
<style type="text/css">
<!--
/* CSS Document */
/*Butterfly site - an content managment system*/

html, body, ul, li, ol, p, h1, h2, h3, h4, h5, h6, forms, fieldset	{
margin:0px;
padding:0px;
border:0px;
}


/*--------------------------------------------

define fonts for the whole site. 
Text align:center is a IE5 bug fix - doesn't use margin:auto
Take care to set all font sizes in px - don't mix %, px and em

Gives top and bottom margin to the whole page
-----------------------------------------------
*/

body	{
text-align:center;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
line-height:1.5;
color:#333333;
}


/*define p top and bottom padding for the whole site*/

p {
padding-top:10px;
margin-bottom:25px;
}

/*center the whole page, give it a width of 760px
test-align:left undoes the IE5 bug fix in body, and puts all text back to the left.*/


#wrapper	{
width:760px;
margin:0px auto;
text-align:left;
padding:0px;
border:solid 1px black;
}

/*--------------------------------
banner for the image to live in
--------------------------------*/
#banner	{
margin:0px;
padding:0px;
}


.images	{
padding:0px;
margin:0px;
}

/*--------------------------------
for now I am just going to use bog standard links. Later I want rolloves
---------------------------------*/
#links	{
float:left;
width:125px;
margin:0px;
padding:0px;
background-color:#99CCCC;
}

}
-->
</style>
</head>

<body>
<div id="wrapper">

<div id="banner">
<img class="images" src="images/banner.jpg" height="100" width="760" alt="jpg banner" /> 
</div>
 
<div id="links">
Link 1
</div>  
   

<!--end wrapper-->

<br clear="all" />

</div>

</body>
</html>

"I love deadlines - I love the noise they make as they go wishing past" (not mine of course, but very ture...0
 
Try to add 'vertical-align' property
Code:
.images    {
padding:0px;
margin:0px;
vertical-align:bottom;
}
No gap exists for my IE7 display no matter setting 'vertical-align' property as 'top', 'middle', 'bottom', i cannot figure it out though.

Another, there is a outstanding '}' near style close tag.
Code:
#links    {
float:left;
width:125px;
margin:0px;
padding:0px;
background-color:#99CCCC;
}

}
-->
</style>
 
Yes, that worked too. As did adding display:block

aslo, adding nothing and removing the carriage retunrs around the <img> tag did too.

All weird!

Thanks for the reply

"I love deadlines - I love the noise they make as they go wishing past" (not mine of course, but very ture...0
 
Not too weird. Images are treated as inline objects, meaning that they flow with the normal text unlike the block level elements, which begin a new line every time they start. When IE looks at your code it sees: an image, then some spaces. It renders that and because the images are by default aligned at the baseline of the text, big text will make images appear lower than wanted (where text is just a space). Fixing vertical-align would therefore help. Changing the image to a block level element likewise. It will remove the problem of having text floating by it. And lastly, deleting the white space around the image would make it impossible for the image to have this problem, as no more spaces would exists. It is annoying, but it does make sense.
 
cheers - much clearer - just don't really see why the other browsers don't treat the code the same. No gpa with FF, NS or Opera.

"I love deadlines - I love the noise they make as they go wishing past" (not mine of course, but very ture...0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top