Web Design Forum: Struggling with margin - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Struggling with margin

#1 User is offline   Gary Newport 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 49
  • Joined: 26-June 08
  • Reputation: 0
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 April 2009 - 09:40 PM

I am trying to get a top div to be at the very top. The CSS is...

	body
		{
		font-size: 71%; /* Resets 1em to 10px */
		font-family: Verdana, Arial, Sans-Serif;
		background-color: #f4ead7;
		margin: 0;
		padding: 0;
		}
		
	#top
		{
		position: relative;
		background: url(images/topban.png) top repeat-x;
		height: 300px;
		width: 100%;
		}


The HTML is...
<body>
		<div id="top">
		</div>
	</body>


The issue is that in Firefox and IE8 there is a gap between the top of the window and the top of the div.

However, if I put a border command into the CSS declaration (border: 1px solid #f00;) then the top space disappears. I cannot see the fault; can anyone help?
0

#2 User is offline   bocaj 

  • Retired
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 3,402
  • Joined: 11-January 09
  • Reputation: 99
  • Gender:Male
  • Location:New Sarum
  • Experience:Web Guru
  • Area of Expertise:Entrepreneur

Posted 08 April 2009 - 09:46 PM

got a link? What of you remove position relative? or set border:none;
0

#3 User is offline   Gary Newport 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 49
  • Joined: 26-June 08
  • Reputation: 0
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 April 2009 - 10:04 PM

View Postbocaj, on Apr 8 2009, 22:46, said:

got a link? What of you remove position relative? or set border:none;


It's so in base production but I have uploaded to www.garynewport.com/garynewport3

I tried the border: none; but nothing changed.

Thanks for trying to help!
0

#4 User is offline   bocaj 

  • Retired
  • PipPipPipPipPip
  • View gallery
  • Group: Members
  • Posts: 3,402
  • Joined: 11-January 09
  • Reputation: 99
  • Gender:Male
  • Location:New Sarum
  • Experience:Web Guru
  • Area of Expertise:Entrepreneur

Posted 08 April 2009 - 10:06 PM

in #banner

you have margin-top:25px;

edit: is that not the problem? because i notice your other background has the 25px
0

#5 User is offline   Gary Newport 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 49
  • Joined: 26-June 08
  • Reputation: 0
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 April 2009 - 10:08 PM

View PostGary Newport, on Apr 8 2009, 23:04, said:

It's so in base production but I have uploaded to www.garynewport.com/garynewport3

I tried the border: none; but nothing changed.

Thanks for trying to help!


Okay, cured!

I changed relative to absolute (having nothing did nothing). Absolutes are fine in this instance so...

Thank again.
0

#6 User is offline   Gary Newport 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 49
  • Joined: 26-June 08
  • Reputation: 0
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 08 April 2009 - 10:09 PM

View PostGary Newport, on Apr 8 2009, 23:08, said:

Okay, cured!

I changed relative to absolute (having nothing did nothing). Absolutes are fine in this instance so...

Thank again.


Yeah, the banner's top margin puts the mountain image in the correct position for the background. :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users