469,358 Members | 1,651 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Why is there a space in between my divs?

12
For some reason there is a gap in between some of my <divs>. It doesn't happen at the top to my header and navbar but once I go into my body it starts and I can't figure out why. any help would be greatly appreciated. Heres the link to the page : http://naturalfoodreports.com/chiaseedreport.php

and heres all the code on that page:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Natural Food Reports</title>
  6. <link href="root/reports style/reports.css" rel="stylesheet" type="text/css" />
  7. </head>
  8.  
  9. <body>
  10. <div id="wrapper">
  11. <div id="header">
  12.     <div id="title"><a href="index.php" class="titlelink">Natural Food Reports</a></div>
  13.   </div>
  14. <div id="navbar">
  15.   <div id="homereportsaboutcontact"><a href="index.php"> Home</a> | <a href="reports.php">Reports</a> | <a href="about.php">About</a> | <a href="contact.php">Contact</a></div>
  16. </div>
  17. <div id="reportstitle">
  18.   <p>~Chia Seeds~</p>
  19.   <p><img src="imgs/Health &amp; Super Foods/ChiaSeeds&amp;OtherSeeds/chia seeds.jpg" alt="chiaseeds" width="200" height="200" border="0" /></p>
  20. </div>
  21. <div id="researchresultstitle";>Research Results:</div>
  22. <div id="researchresults">
  23.   <p>&quot;...when you hydrate the seeds in water the seeds shell opens up and absorbs   up to nine times its volume in water. This then forms a gel, which is   called Chia Seed Gel. It is said that the gel has the potential to help   keep your body hydrated. The gel is also 90% soluble fiber, which may be   beneficial for your digestive track. Many people say that they use the   seeds when they are involved in sports or physical activities for   endurance.&quot; </p>
  24.   <p>&quot;....the seeds have twice the protein of any other seed or grain, five times   the calcium of milk, boron which is trace mineral that helps transfer   calcium into your bones, omega 3 and omega 6 which are essential oils   for the body.&quot;</p>
  25. <p>&quot; ...the soluble fiber in the gel forms a wall between carbohydrates and the   body, releasing them slowly into the body. Dieters love the seeds   because it can be added to any food or drink in a ratio of 75% to the   volume of food or drink and will not change the taste. Because the   carbohydrates are released slowly you may get the feeling of being full.   Many use the seeds as a way to control their appetites. The gel has no   taste.&quot; </p>
  26. </div>
  27. <div id="logo">Eat Better. Feel Better. Live Better.</div>
  28.   <div id="footer">&copy; 2010  Natural Food Reports
  29. </div>
  30. </div>
  31. </body>
  32. </html>
  33.  



Heres the code on my external style sheet attached to that page:

Expand|Select|Wrap|Line Numbers
  1. body {
  2.     margin: 0px;
  3.     font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  4.     background-image: url(v2bg.jpg);
  5. }
  6.  
  7. #wrapper {
  8.     margin: 0px;
  9. }
  10.  
  11. #header {
  12.     background-image: url(newbanner.jpg);
  13.     height: 200px;
  14. }
  15.  
  16. #title {
  17.     font-family: "Lucida Console", Monaco, monospace;
  18.     font-size: 55px;
  19.     color: #000;
  20.     position: absolute;
  21.     left: 320px;
  22.     top: 79px;
  23.     width: 669px;
  24.     height: 58px;
  25. }
  26. .titlelink:link{
  27.     color:#000;
  28.     text-decoration:none;
  29.     font-size: 50px;
  30.     font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  31. }
  32. .titlelink:hover { color:#000;
  33. }
  34. .titlelink:visited{ color:#000;
  35. text-decoration:none;
  36. }
  37. .titlelink:active{ color:#000;
  38. text-decoration:none;
  39. }
  40. #logo {
  41.     position:absolute;
  42.     width:284px;
  43.     height:32px;
  44.     z-index:1;
  45.     left: 322px;
  46.     top: 130px;
  47.     color: #FFF;
  48. }
  49. #navbar {
  50.     background-color: #FFF;
  51.     background-image: url(navbar.jpg);
  52.     background-repeat: no-repeat;
  53.     height: 30px;
  54.     width: 100%;
  55.     margin: 0px;
  56. }
  57. #homereportsaboutcontact {
  58.     color: #000;
  59.     margin-left: 400px;
  60. }
  61. #reportstitle{
  62.     font-size: 24px;
  63.     color: #000;
  64.     font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  65.     text-decoration: none;
  66.     background-color: #FFF;
  67.     text-align: center;
  68.     width: 800px;
  69.     margin-right: auto;
  70.     margin-left: auto;
  71.     clip: rect(0px,auto,auto,auto);
  72. }
  73. #researchresultstitle {
  74.     font-size: 24px;
  75.     text-align: center;
  76.     background-color: #FFF;
  77.     margin-top: 0px;
  78.     width: 800px;
  79.     margin-right: auto;
  80.     margin-left: auto;
  81. }
  82. #researchresults {
  83.     background-color: #FFF;
  84.     margin-right: auto;
  85.     margin-left: auto;
  86.     width: 800px;
  87.     font-size: 14px;
  88. }
  89.  
  90. #footer {
  91.     background-color: #999;
  92.     height: 60px;
  93.     text-align: center;
  94.     font-weight: bold;
  95.     margin-bottom: 0px;
  96. }
  97.  
  98.  
  99.  
  100.  
  101.  
  102. .bluelinks:link {
  103.     color:#00F;
  104.     font-size: 14px;
  105. }
  106. .bluelinks:visited { color:#00F;
  107. text-decoration:underline;
  108. }
  109. .bluelinks:visited { color:#00F;
  110. text-decoration:underline;
  111. }
  112. .bluelinks:hover { text-decoration:underline;
  113. }
  114. a:img{ border:0;
  115. }
  116. a:link{
  117.     color:#000;
  118.     text-decoration:none;
  119.     font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  120.     font-size: 18px;
  121. }
  122. a:hover{
  123.     color:#000;
  124.     text-decoration:underline;
  125. }
  126. a:visited{
  127.     color:#000;
  128.     text-decoration: none;
  129. }
  130.  
  131.  
  132. a:active{
  133.     color:#000;
  134.     text-decoration:none;
  135.     text-align: center;
  136. }
  137.  
tom
Sep 23 '10 #1

✓ answered by drhowarddrfine

You have margin set to zero on the divs but it's the p element that has margins that are pushing up against the other divs.

7 5721
drhowarddrfine
7,435 Expert 4TB
Most elements have a default margin applied to them. I'm not on my dev computer to check but applying 'margin:0' to the paragraphs, divs will probably solve that.
Sep 23 '10 #2
tx9271
12
my margins are auto for left and right and when i set the top to 0 nothing happens it still stays the same; with a gap. :(
Sep 23 '10 #3
drhowarddrfine
7,435 Expert 4TB
You have margin set to zero on the divs but it's the p element that has margins that are pushing up against the other divs.
Sep 23 '10 #4
tx9271
12
omg. lol thank you so much. i didnt even think to check that. thanks again
Sep 23 '10 #5
tx9271
12
i just a new css rule for "p" making it have a margin 0 for all. that should fix the problem for good right?
Sep 23 '10 #6
drhowarddrfine
7,435 Expert 4TB
Yes. Some people set margins on everything to zero and then reset them to what they want. Google for "CSS Reset". The problem is, if they are going to set it to something else anyway, why are they setting it to zero? That's why many don't think it's a good idea.
Sep 23 '10 #7
tx9271
12
yea i just set all "p" to zero margin because I have margins left and right on auto for a lot of my divs so that wouldn't really work for me. but, i did solve this little problem thanks to you!!

I really appreciate you taking the time to reply to my thread. Hopefully one day I can help people too like how you helped me. Thanks again!
Sep 23 '10 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by mattbostock | last post: by
2 posts views Thread by D. Alvarado | last post: by
8 posts views Thread by maroger | last post: by
3 posts views Thread by Veerle | last post: by
8 posts views Thread by removeps-groups | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.