Hello there.

What I am getting
What i should get

Ofcourse without the lines..

my code index.html:

<!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=utf-8" />
<title>Untitled Document</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>

<body>


<div id="container">
<div id="logo">
</div>
<ul id="top-nav">
    <li id="home"><a href="http://funnymash.com">Home</a></li>
    <li id="about"><a href="">Hoe werkt het?</a></li>
    <li id="blog"><a href="">Voorwaarden</a></li>
    <li id="photos"><a href="">Contact</a></li>
    <li id="forum"><a href="">Uitbetaling</a></li>
    </ul>
<div id="content">
<center>
<h1>Some more lorem ipsum</h1>
<div id="lorem">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p>
</div>
</center>
</div>

<div id="wit">
a
a <br  />
a
</div>
<div id="footer">
</div>
</div>

</body>
</html>

CSS code

@charset "utf-8";
/* CSS Document */

p {
color: #FFF
}

body{
	font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
	background: #FFF;
}

#logo{
	background: url(../images/logo.png) no-repeat;
	width:137px;
	height:24px;
	float:left;
	display: inline;
	margin: 18px 0 0 0;
}

#container {
	width:1000px;
	height:auto;
	margin-left:auto;
	margin-right:auto;
}

#content {
	display:block;
	margin: 71px 0 0 0;
	background: url(../images/bigbg.png) no-repeat;
	height:350px;
	width:1000px;

}

#footer {
	display:block;
	margin: 325px 0 0 0;
	background: url(../images/footerbg.png) repeat-x;
	width:1000px;
	height:168px;
}

ul#top-nav {
	list-style-type:none;
	float:right;
	display:inline;
	height:25px;
	margin-top:21px;
	width:500px;
}

ul#top-nav li {
	display:inline;
	float:left;
	margin: 18 29px 0 0;
}

#home {
	margin: 5px;
}

A:link {
	text-decoration: none; color:#99cce6;
	font-size:14px;
}

A:visited {
	text-decoration: none
}

A:active {
	text-decoration: none
}

A:hover {
	text-decoration: underline;
	}

h1 {
font-size: 40px;
color: #FFF;
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
}

#lorem{
	width:571px;
	margin-left:auto;
	margin-right:auto;
}

The links are a example btw, those are not supposed to refer to the pages they are reffering to now.

Dani AI

Generated

Classic float-containment issue. As discovered, adding a clearing mechanism fixed the immediate symptom; ’s suggestion to separate header/menu into distinct blocks also makes layout intentions clearer. Dreamweaver’s design/preview can mask float-collapse problems, so a layout that looks fine there may still break in real browsers.

A more maintainable approach is to contain floats in the parent so you don’t need empty clearing markup. Two simple options:

/* modern clearfix (no extra HTML) */
.clearfix::after {
  content: "";
  display: table;
  clear: both;
}
.clearfix { zoom: 1; } /* optional for very old IE */
/* alternative: create a block formatting context */
#container {
  overflow: auto; /* or overflow:hidden but beware clipping */
}

Consider moving away from floats for header/menu alignment and use flexbox for a cleaner, responsive layout:

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

Quick troubleshooting steps: open browser devtools and inspect the container’s computed height; toggle the parent’s background to see if it’s collapsing; temporarily remove fixed heights and margins to isolate the cause; replace deprecated layout markup (like the legacy center element) with CSS centering. Also avoid fixed pixel heights on containers that must expand with content.

For reference reading on how floats behave and common containment patterns, see MDN: float and the CSS-Tricks clearfix pattern.

Recommended Answers

All 3 Replies

To me it's a bit strange what DW has come up with. Anyhoo, you should start with something like this:

<div id="container">
  <div id="header">
    <div id="logo">
    </div>
    <div id="menu">
      menu items
    </div>
  </div>
  <div id="content">
    <h1>Hi</hi>
    <p>Your text</p>
  </div>
  <div id="footer">
  </div>
</div>

And then try to style that.

I solved it with, div id = clear and but in .clear { clear:both; }
:D

Wow, we posted at the same time. Thanks for your post. And now I see that styling is way better.. Will use that. Thanks!

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.