float:left browser compatibility. or what am I doing wrong here?

windows

Guest
I'm having trouble with my page layout.
My source code looks like:

<!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>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis" />
<link href=http://www.webdeveloper.com/forum/archive/index.php/"markup.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="top">Header</div>
<div id="leftcolumn">
<div>
<h3>Left Column </h3>
<p>article text here. article text here. article text here. article text here. article text here. article text here. article text here. article text here. </p>
<h3>Title</h3>
<p>article text here. article text here. article text here. article text here. </p>
</div>
</div>
<div id="rightcolumn">Right Column </div>
<div id="centercolumn">
<div class="class1">
<h1>Main Topic</h1>
<ul>
<li>subtopic1</li>
<li>subtopic2</li>
<li>subtopic3</li>
<li>subtopic4</li>
<li>subtopic5</li>
<li>subtopic6</li>
<li>subtopic7</li>
</ul>
</div>
<div class="class2">
<h1>Main Topic 2</h1>
<ul>
<li>subtopic1</li>
<li>subtopic2</li>
<li>subtopic3</li>
<li>subtopic4</li>
</ul>
</div>
</div>
<div id="footer">Content for id "footer" Goes Here</div>

</body>
</html>


The CSS is:

#top {
background-color: #333333;
}

#leftcolumn {
float: left;
width: 240px;
background-color: #999999;
}

#centercolumn {
margin-left:246px;
margin-right: 246px;
}

#centercolumn ul {
list-style: none;
}

#centercolumn li {
display : block;
float : left;
text-align : center;
width : 15em;
}

#rightcolumn {
float: right;
margin:0px 0px 0px 0px;
width: 240px;
background-color: #999999;
}


#footer {
position:relative;
clear:both;
background-color: Black;
}

.class2 {

}


IE6 shows the page how I want the browsers to show. But this doesn't work under Mozilla 1.6 and Opera 7.
Now, when I put a "clear:left" in ".class2", in Moz it looks fine, but this time not with IE/Opera. I'm starting to get a headache here ...

Any help would be appreciated.:(

p.s. here is a sample image of "how I want it to be":
<!-- m --><a class="postlink" href="http://www.geocities.com/staccb123/sample.gifThe">http://www.geocities.com/staccb123/sample.gifThe</a><!-- m --> display : block; float : left; in #centercolumn li are causing the problem.I removed the "display:block", but that doesn't make any changes?

Here is my sample page:
<!-- m --><a class="postlink" href="http://www.geocities.com/staccb123/index.htmland">http://www.geocities.com/staccb123/index.htmland</a><!-- m --> the float:left;Originally posted by Fang
and the float:left;

Hi Fang,
when I remove float:left I don't get the desired result.

What's important to me, or better to say, what my problem is, is the *layout in the center column*. As you can see in the sample image I want some main topics, followed by some sub-topics which are aligned from left to right over some lines. That's why I used "float:left". The length of the subtopics differ, so I want the text aligned to the center (centered in every <td>, like when they were in a table).
If I don't use "clear:left" in class2, Mozilla (Firefox) and Opera7 show the "Main Topic 2" right after "subtopic7". But when use "clear:left" in "class2", Opera & IE show a big "gap" between "subtopic7" and "Main Topic 2". The "gap" depends on the length of the left column (that's why I also put in the left column into my sample).Your image is not available and the description a little confusing.hmm, seems like you first have to go to <!-- m --><a class="postlink" href="http://www.geocities.com/staccb123/">http://www.geocities.com/staccb123/</a><!-- m -->
then enter the URL
<!-- m --><a class="postlink" href="http://www.geocities.com/staccb123/sample.gifYou">http://www.geocities.com/staccb123/sample.gifYou</a><!-- m --> can not split lists like that. Try this:
<div id="centercolumn">
<h1>Main Topic 1</h1>
<div>
<div style="float:left;width:33%; text-align:center;padding:0px;margin:0;">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic1</a><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic4</a><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic7</a><br />
</div>
<div style="float:left; width:33%; text-align:center;padding:0px;margin:0;">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic2</a><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic5</a>
</div>
<div style="float:left; width:33%; text-align:center;padding:0px;margin:0;">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic3</a><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic6</a>
</div>
<div> </div>
</div>
<h1>Main Topic 2</h1>
<div>
<div style="float:left;width:33%; text-align:center;padding:0px;margin:0;">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic1</a><br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic4</a><br />
</div>
<div style="float:left; width:33%; text-align:center;padding:0px;margin:0;">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic2</a><br />
</div>
<div style="float:left; width:33%; text-align:center;padding:0px;margin:0;">
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#">subtopic3</a><br />
</div>
<div> </div>
</div>
</div>
 
Back
Top