top and left margin around content div

This is a discussion on "top and left margin around content div" within the Starting Out section. This forum, and the thread "top and left margin around content div are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Starting Out

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 1st, 2007, 21:49
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
top and left margin around content div

Hi,

I've got a content div to which I've applied the following css.

#content {width:730px; margin:0 auto; background:#F0F0DE url(cedarscafe.gif) no-repeat ;}

I am getting a margin at the top of about 10px between the content div and the browser window and also when I pull the width of the screen in I am getting the same margin on the left.

How can I prevent this gap?

Any help greatly appreciated.

Paul Rich
Reply With Quote

  #2 (permalink)  
Old Jul 1st, 2007, 21:52
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: top and left margin around content div

Try:

Code: Select all
*{margin:0; padding:0;}
Put this at the top of your css. It will set all margins and paddings to 0.
It can cause some problems but may solve your problem.

Pete.
Reply With Quote
  #3 (permalink)  
Old Jul 1st, 2007, 22:03
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Re: top and left margin around content div

Spot on pa007, you are a gentleman and a scholar. Do you know what the logic is behind that? as I didn't think that divs had default margins.
Reply With Quote
  #4 (permalink)  
Old Jul 1st, 2007, 22:51
SuperMember

SuperMember
Join Date: May 2006
Location: North West, UK
Age: 22
Posts: 1,173
Thanks: 0
Thanked 0 Times in 0 Posts
Re: top and left margin around content div

Different browser set different default margins on all different elements. It could have been a margin on something like the body element or any adjacent element.

Pete.
Reply With Quote
  #5 (permalink)  
Old Jul 2nd, 2007, 05:56
SuperMember

SuperMember
Join Date: May 2007
Location: UK
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Re: top and left margin around content div

Thanks Pete,

Really appreciate your help.

Paul
Reply With Quote
Reply

Tags
margin

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expandable Content Script (Swtich Content) Matc JavaScript Forum 0 Apr 8th, 2008 10:53
Content Placement + Content Dividing josephman1988 Website Planning 2 Jan 22nd, 2008 05:02
Why am I getting a margin when not specified AdRock Web Page Design 4 Mar 14th, 2007 22:06
margin? nasumaru Web Page Design 14 Jan 30th, 2007 21:52
Margin top IE csa Web Page Design 5 Apr 6th, 2006 03:45


All times are GMT. The time now is 08:01.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43