Forum Moderators: not2easy

Message Too Old, No Replies

Floating two lists beside each other

         

madmatt69

11:18 pm on Jul 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey all,

What i'm trying to do should be relatively easy, but I'm stuck...

I've got two lists that I'm trying to float beside each other.

My markup looks like this:

<ul style="float:left;"><li>Content</li><li>Content 2</li></ul>
<ul style="float:left;"><li>Content3</li><li>Content 4</li></ul>

Is there something I'm missing? I'd like to not have to resort to tables for this!

lavazza

12:26 am on Jul 19, 2008 (gmt 0)

10+ Year Member



I think that display:inline-block; is the key

The following works for me:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>edit</title>
<style type="text/css">
.myClassName ul {
display:inline-block;
list-style-type: none;
background:#ccc;
}
</style>
</head>
<body>
<div class="myClassName">
<ul><li>Content</li><li>Content 2</li></ul>
<ul><li>Content3</li><li>Content 4</li></ul>
</div>
</body>
</html>