Jump to content

Layering Help!


remrow
 Share

Recommended Posts

I don't know what is wrong with this code.The space on the top of the page pops up from no where! (I am using firefox3.0)What to do to remove the space on the top of the page...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><style type="text/css"><!--body {	background-color: #0099FF;	margin-left: 0px;	margin-top: 0px;	margin-right: 0px;	margin-bottom: 0px;}#main {	display:block;	background:#63716a;	width:900px;	padding-bottom:10px;}#submain {	display:block;	background:#FFFFFF;	margin:0px 10px 0px 10px;}#navyellow {	background:#FFCC00; width:300px; height:200px;}--></style></head><body><center><div id="main"><div id="submain"><div id="navyellow">  <p>This is a test text</p>  <p>This is a test text</p>  <p>This is a test text  </p></div></div></div></center></body></html>

Link to comment
Share on other sites

The <p> elements (an any elements that have a margin) apply their margin to the furthest ancestor node that doesn't have padding or border, or that don't use the overflow property.You can solve it in two ways:

  1. Apply margin: 0; to all <p> elements.
  2. Apply overflow: auto; or overflow: hidden; to the immediate parent of the <p> element.

I personally prefer the second solution.

Edited by Ingolme
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...