/    Sign up×
Community /Pin to ProfileBookmark

float property

i have a web page in which it is made up of the following: At the top i have a php include file (top menu), then i have a <div> (where inside this div i have the contents of the page), and then i have another php include file (bottom menu).

Inside the <div> i have a <ul> with some <li>s in it. Eventually, i need to display the <li> next to each other rather than under each other … so i used the property float: left;

However, my problem is that this <ul> is being displayed outside my <div> and on top of my bottom menu in Mozilla browser while in IE is being displayed correctly. Hereunder is the code for both my webpage and the css styles in question … any suggestion on this is greatly appreciated:

main page code:

[Code]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>Malta Postage Stamps</title>
<link rel=”stylesheet” type=”text/css” href=”../main.css” >
<script language=”JavaScript” type=”text/JavaScript” src=”../imagescript.js”></script>
<meta name=”Description” content=”Maltese Postage Stamps” >
<meta name=”Keywords” content=”malta, maltese, philately, stamps, postage, collection, sell” >
</head>
<body>
<?php include (“../menus/topmenu.php”); ?>
<div class=”mainpage”>
<h2>MALTA STAMPS</h2>
<ul class=”stamps”>
<li class=”stamps”><a href=”../images/actual/malta/mlt0001.jpg” windowheight=”332″ windowwidth=”542″ imageheight=”307″ imagewidth=”517″ imagedescription=”mlt0001″>
<img src=”../images/thumbs/malta/mlt0001.jpg” width=”168″ height=”100″ alt=”mlt0001″>
</a><br>MLT0001
</li>
<li class=”stamps”><a href=”../images/actual/malta/mlt0002.jpg” windowheight=”335″ windowwidth=”542″ imageheight=”310″ imagewidth=”517″ imagedescription=”mlt0002″>
<img src=”../images/thumbs/malta/mlt0002.jpg” width=”167″ height=”100″ alt=”mlt0002″>
</a><br>MLT0002
</li>
<li class=”stamps”><a href=”../images/actual/malta/mlt0003.jpg” windowheight=”353″ windowwidth=”581″ imageheight=”328″ imagewidth=”556″ imagedescription=”mlt0003″>
<img src=”../images/thumbs/malta/mlt0003.jpg” width=”170″ height=”100″ alt=”mlt0003″>
</a><br>MLT0003
</li>
</ul>
</div>
<script type=”text/javascript”>
parsePage();
</script>
<?php include (“../menus/bottommenu.php”); ?>
</body>
</html>[/Code]

Styles:

[Code]
div.mainpage
{
background-color: #f5f5dc;
border: solid 2px #a52a2a;
text-align: justify;
}

ul.stamps
{
width: 80%;
margin-left: 10px;
margin-bottom: 0;
padding: 5px;
}

li.stamps
{
list-style-type: none;
float: left;
padding-right: 5px;
text-align: center;
}[/Code]

Thank You

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@FangFeb 23.2005 — Add clear:both
&lt;/ul&gt;
[COLOR=green]&lt;div style="clear:both;"&gt;&lt;/div&gt;[/COLOR]
&lt;/div&gt;
&lt;script type="text/javascript"&gt;
parsePage();
&lt;/script&gt;
Copy linkTweet thisAlerts:
@CassiusauthorFeb 23.2005 — <div style="clear:both;"></div>

yes that was the problem, actually i read about it[URL=http://www.positioniseverything.net/easyclearing.html]here[/URL].

According to the above article, it seems that this behaviour in Mozilla happens when the div has a visible border and/or background (as was in my situation).

Thank You very much for your help ... problem sorted ?
Copy linkTweet thisAlerts:
@toicontienFeb 23.2005 — Someone else ran into this same issue actually. I gave this guy a quick and dirty explanation of floats, which you may find useful too: http://www.webdeveloper.com/forum/showthread.php?s=&threadid=51576
×

Success!

Help @Cassius spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...