Hi guys,
Apologies for posting another one of these - I have tried to do it myself, but no luck.

My site has an unwanted space at the top of each page. I'm new to web design (and a rank amateur as you can see).

I've read some other threads on the topic and it seems that it's something to do with margin collapse in css? I've tried resetting top margin to zero in lots of places but it hasn't helped.

So here's the css (whole lot I'm afraid as I'm not sure which bit is to blame) and a link to the site. If anyone can throw light on it, that would be great.

And while you are there, if you have any other feedback re my site that could make it more professional, that would be lovely.

Thanks muchly,

Rosie

http://www.interactivewhiteboardswa.com.au

@charset "utf-8";
.formtext {
	font-size: 0.9 em;
	color: #707169;
}
.orangeheading {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1em;
	color: #FF9602;
	font-weight: bold;
}


p {
	font-size: 0.8em;
	color: #707169;
	line-height: 1.5em;
	margin-top: .5 em;
}

.textforresources {
	margin-left: 20px;
	width: 200px;
	margin-top: 0px;
	padding-top: 0px;
	float: left;
	line-height: 1em;
}

img
{  border-style: none;
}

.tabletext {
	color: #707169;
	font-size: 0.8em;
	text-align:center;
}

.imageresize {
	width: 200px;
	height: 150px;
	border: none;
}

a:link, a:visited 
{
	text-decoration: none;
	color: #0D5DA5;
	font-weight: bold;
}

a:hover, a:active
{
	color: #FF9602;

}

.flipchartimg {
	float: left;
	width: 200px;
	margin-top: 10px;
	margin-left: 20px;
	
}
.bulletpoint2 {
	list-style-type: circle;
	color: #707169;
	font-size: 0.8em;
	line-height: 1.5em;
}





.twoColFixLtHdr #container { 
	width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
	background: #FFFFFF;
	margin: 0 auto; /* the auto margins [for left and right](in conjunction with a width) center the page */
	border: 1px solid #000000;
	text-align: left; /* this overrides the text-align: center on the body element.[iE5 hack] */
} 
.twoColFixLtHdr #container #header ul {
	margin: 0;
	padding: 0;
	list-style: none;
	position: absolute;
	right: -2px;
	bottom: 0px;
}
.bulletpoints {
	list-style-type: disc;
}


.twoColFixLtHdr #container #header li {
	display: inline;
	
}

.twoColFixLtHdr #container #header li a:link,.twoColFixLtHdr #container #header li a:visited 
	{
	padding: 0em .5em;
	font: bold 0.9em Arial, Helvetica, sans-serif;
	text-decoration: none;
	color:#FFFFFF;
	}


.twoColFixLtHdr #container #header li a:hover,.twoColFixLtHdr #container #header li a:active 
	{
	color:#999999;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	}

.twoColFixLtHdr #container #header li a.current, .twoColFixLtHdr #container #header li a.current:active, .twoColFixLtHdr #container #header li a.current:hover
{
	color: #FF9602;
	cursor: default;
}

.twoColFixLtHdr #mainContent {
	padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
	font: 0.8em Verdana, Arial, Helvetica, sans-serif;
	background-repeat: repeat-x;
	border: 1px solid #EAEAFF;
	margin-left: 240px;
	margin-top: 0 px;
	width: 490px;
	margin-bottom: 10px;
	position: relative;
} 
.twoColFixLtHdr #container #mainContent h1 {
	font-size: 1.1em;
	line-height: 1em;
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	margin-top: 20px;
	color: #666666;
}
.twoColFixLtHdr #container #mainContent #leftPic {
	float: left;
	height: 155px;
	width: 225px;
	margin-right: 10px;
}


.twoColFixLtHdr  #mainContent  #mainPic  {
	float: right;
	width: 220px;
	background-image: url(../sideBarBackground.png);
	height: 280px;
}

#websiteheader {
	margin: 0;
	background-image:url(images/headerBannerNoMenu.png);
	display:block;
	height:100px;
	width:780px;
	text-indent:-9999px;
	}


.twoColFixLtHdr #header {
	margin: 0;
	padding: 0;
	height: 100px;
	position: relative;
} 
.twoColFixLtHdr #header h1 {
	margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
	padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.twoColFixLtHdr #sidebar1 {
	float: left; /* since this element is floated, a width must be given */
	width: 200px; /* the background color will be displayed for the length of the content in the column, but no further */
	padding: 5px 10px 15px 5px;
	margin-top: 20px;
	margin-right: 0px;
	margin-bottom: 0px;
	margin-left: 10px;
	height: 250px;
	border: 1px solid #EAEAFF;
	font: normal 0.8em Arial, Helvetica, sans-serif;
}

.twoColFixLtHdr #sidebar1 ul
{
	padding: 0;
	list-style: none;
	margin: 0;
}

.twoColFixLtHdr  #sidebar1  li
{
	text-decoration:none;
	margin:0;
	color: #666666;
	line-height: 40px;
	background-position: left center;
	display: block;
	padding-left: 0px;
	font-weight: normal;
}
.border {
	border: 5px double #666666;
	margin-left: 30px;
}



.twoColFixLtHdr  #sidebar1  li  a:link,.twoColFixLtHdr  #sidebar1  li  a:visited 
{
	text-decoration:none;
	margin:0;
	color: #666666;
	background-repeat: no-repeat;
	font-size: 0.9em;
	line-height: 40px;
	background-image: url(images/menuButton.png);
	background-position: left center;
	display: block;
	padding-left: 38px;
	font-weight: normal;
}

.twoColFixLtHdr #sidebar1 li a:hover,.twoColFixLtHdr #sidebar1 li a:active 
	{
	color: #FF9602;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	}
	
.twoColFixLtHdr #sidebar1 li a.sbCurrent, .twoColFixLtHdr #sidebar1 li a.sbCurrent:active, .twoColFixLtHdr #sidebar1 li a.sbCurrent:hover

	{
	background-image: url(images/menuButtonRollover.png);
	color:#666666;
	cursor: default;
	font-weight: bold;
	}
	
.twoColFixLtHdr #footer {
	padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
	background:#DDDDDD;
} 
.twoColFixLtHdr #footer p {
	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
	padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
	float: right;
	margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
	float: left;
	margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
	clear:both;
	height:0;
	font-size: 0px;
	line-height: 0px;
}
.floatimgleft {
	float: left;
	margin-right: 10px;
	border: medium ridge #CCCCCC;
}

.floatimgright {
	float: right;
	margin-left: 10px;
	border: medium ridge #CCCCCC;
}
.floatleftimgnoborder {
	float: left;



	margin-right: 30
';
	margin-right: 20px;
}

.twoColFixLtHdr #container #gsearch {
	float: left;
	margin-left: 50px;
	margin-right: 100px;
	margin-bottom: 20px;
	padding-bottom: 0px;
}

Recommended Answers

All 4 Replies

Many thanks Eric, that's a good idea. I'll have a go at it when I'm back at work and see it I can get it working.
And sorry about posting all the css (embarrassed icon if I could find one).

Did take a look at your site. The is only one thing you need to change. In your css wite

body {margin:0}

That should do it.
I tried it with firebug (add on for firefox). The output of firebug is here:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body class="twoColFixLtHdr" style="margin: 0pt;">
<div id="container">
</div>
</body>
</html>

The top margin is gone.

Did take a look at your site. The is only one thing you need to change...

Thanks very much colweb, I finally got to try this and it worked perfectly. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.