School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,492 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,842 people online right now. Registration is fast and FREE... Join Now!




problem with DIV spacing

 

problem with DIV spacing

tommyflint

18 Jun, 2009 - 12:31 PM
Post #1

D.I.C Addict
Group Icon

Joined: 24 Jul, 2008
Posts: 584



Thanked: 28 times
My Contributions
Hey guys,

I've been trying to work out why there is a space at the top and bottom of my Mainontent DIV here is the URL http://www.iflintinternet.co.uk/Tim.html i have added the CSS to the page so you can see it. The left and right borders are around the MainContent DIV this shows you that it doesn't reach the containor DIV like i want it too smile.gif

cheers,

tommyflint

User is offlineProfile CardPM
+Quote Post


crazyjugglerdrummer

RE: Problem With DIV Spacing

18 Jun, 2009 - 12:49 PM
Post #2

YOUR AD HERE
Group Icon

Joined: 7 Jan, 2009
Posts: 677



Thanked: 94 times
Dream Kudos: 425
My Contributions
Your div has no vertical spacing, but the header at its top does, and that's what's pressing the whole thing down. Just use

h1 {
margin: 0px;
}

biggrin.gif
User is offlineProfile CardPM
+Quote Post

djkitt

RE: Problem With DIV Spacing

18 Jun, 2009 - 12:49 PM
Post #3

D.I.C Head
**

Joined: 22 May, 2008
Posts: 170



Thanked: 23 times
My Contributions
So, you have a 1 pixel solid black border around container. Because the body background color is also black it makes it appear as if mainContent has a 1 pixel space around it.

/Edit/

Also, the h1, h3 and p elements have an automatically applied margin as
tommyflint stated. Just add the following to get rid of it:

CODE

h1, h3{
   margin-top:0;
   padding-top:.5em;
}
p {
   margin-bottom: 0;
   margin-top:0;
   padding-bottom:1em;
}


/End edit/

Hope this helps,

Kitt

This post has been edited by djkitt: 18 Jun, 2009 - 01:20 PM
User is offlineProfile CardPM
+Quote Post

tommyflint

RE: Problem With DIV Spacing

19 Jun, 2009 - 07:01 AM
Post #4

D.I.C Addict
Group Icon

Joined: 24 Jul, 2008
Posts: 584



Thanked: 28 times
My Contributions
Cheers guys that fixed the problem smile.gif

tommyflint
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 04:34AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month