Connecting Tech Pros Worldwide Forums | Help | Site Map

IE isn't spacing my divs properly

insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#1: Jul 31 '08
OK, I'm sure this is probably me just being a noob to CSS, but I'm running into a problem. I'm using images to give the appearances of rounded corners to a div, but for some reason, IE7 is still putting some space between the "mainContent" div and the "capBottom" div. Firefox and Opera render it the way I want.

Here's an image of what's wrong:


Here's what it looks like in Firefox:



Heres the HTML:
Expand|Select|Wrap|Line Numbers
  1. <div id="container">
  2.     <div id="nav">
  3.         <div id="navBanner">
  4.             <asp:Image ID="longLogo" runat="server" ImageUrl="~/images/banner.png" />
  5.         </div>
  6.         Links will go here
  7.     </div>
  8.     <div id="content">
  9.         <div id="right">
  10.             <div id="capTop">
  11.                 <asp:Image ID="imgCapTop" runat="server" ImageUrl="~/images/roundCapTop.png" />
  12.             </div>
  13.             <div id="mainContent">
  14.                 Content will go here
  15.             </div>
  16.             <div id="capBottom">
  17.                 <asp:Image ID="Image1" runat="server" ImageUrl="~/images/roundCapBottom.png" />
  18.             </div>
  19.         </div>
  20.     </div>
  21. </div>
  22.  
Here's the stylesheet:
Expand|Select|Wrap|Line Numbers
  1. body
  2. {
  3.     font-family: Calibri;
  4.     background-color: #d4d5d5;
  5.     background-image: url( '../images/backgrad.jpg' );
  6.     background-repeat: repeat-x;
  7. }
  8.  
  9. #right
  10. {
  11.     float: left;
  12.     width: 770px;
  13.     min-height: 600px;
  14.     padding-left: 15px;
  15.     padding-right: 15px;
  16.     background-color: Transparent;
  17.     display: inline;
  18. }
  19. #nav
  20. {
  21.     font-size: 13px;
  22.     height: 100px;
  23.     text-align: center;
  24.     width: 788px;
  25.     background-color: transparent;
  26.     margin-bottom: 20px;
  27. }
  28. #navBanner
  29. {
  30.     text-align: right;
  31. }
  32. #container
  33. {
  34.     clear: both;
  35.     margin-top: 15px;
  36.     width: 800px;
  37.     margin-left: auto;
  38.     margin-right: auto;
  39. }
  40. #content
  41. {
  42.     clear: both;
  43.     margin-top: 15px;
  44.     width: 800px;
  45. }
  46. #capTop
  47. {
  48.     width: 770px;
  49.     height: 12px;
  50.     background-color: Transparent;
  51.     margin-bottom: 0px;
  52. }
  53. #capBottom
  54. {
  55.     margin-top: 0px;
  56.     width: 770px;
  57.     height: 12px;
  58.     background-color: Transparent;
  59. }
  60. #mainContent
  61. {
  62.     margin-top: 0px;
  63.     background-color: White;
  64.     margin-bottom: 0px;
  65.     width: 770px;
  66.     min-height: 550px;
  67. }
  68.  
So what am I doing wrong? Is there some IE specific stuff I need, or am I just missing something?

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,574
#2: Jul 31 '08

re: IE isn't spacing my divs properly


Yes, this is an IE-bug bug I need a minute to try and remember how to fix it.
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,574
#3: Jul 31 '08

re: IE isn't spacing my divs properly


I was trying to find my rounded corner images to emulate your markup but can't get to them. There are 2 possibilities but I can't test them. All are IE bugs. (Man, I'm starting to forget some things while I'm off doing C-coding.)

1) Make sure there is no whitespace between the end of the <img> tag and the next tag.

2) See if making margins/padding of the image and/or its container have bottoms set to 0.

EDIT: Also, try setting the <img> to 'display:block'
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#4: Jul 31 '08

re: IE isn't spacing my divs properly


Quote:

Originally Posted by drhowarddrfine

1) Make sure there is no whitespace between the end of the <img> tag and the next tag. '

OK, seriously. That is a ridiculous bug! Why should whitespace affect the markup!

But this was the solution. Thanks a whole lot.
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,574
#5: Jul 31 '08

re: IE isn't spacing my divs properly


Because all versions of IE are the worst browsers on the planet with no relief in sight.
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#6: Jul 31 '08

re: IE isn't spacing my divs properly


Oh, I know. I just remember from the very first lesson in HTML that I got was that whitespace didn't matter...and then I find this ridiculous bug 8 years later ='(
Reply


Similar HTML / CSS bytes