/    Sign up×
Community /Pin to ProfileBookmark

My goal is to have a list display in columns. My current test page, which is very basic, displays correctly in IE and Opera. However, it doesn’t display properly in NS and Moz.

I’ve included the page (very basic). BTW, the colors were just to see the delimitation of the elements on the page ?

Is it even possible to have lists display in a specified number of columns?

[code]
<html>
<head>
<style type=”text/css”>
ul {
list-style-type: disc;
width: 100%;
background: pink;
}
li {
background: green;
display: inline;
width: 48%;
}
</style>
</head>
<body>
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
<li>five</li>
<li>six</li>
</ul>
</body></html>
[/code]

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@DaveSWFeb 05.2004 — not unless you

a) break the list into three, float one left, one right, and leave one in the middle

b) add a class to each li - left, right, center, and then float as above.
Copy linkTweet thisAlerts:
@cootheadFeb 05.2004 — Hi there DanDigiMan,

This seems to work OK in IE6, Opera7 and FireBird0.7&lt;html&gt;
&lt;head&gt;
&lt;style type="text/css"&gt;
ul
{
width:100%
}
li
{
float:left;;
width: 19%;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul&gt;
&lt;li&gt;one&lt;/li&gt;
&lt;li&gt;two&lt;/li&gt;&lt;li&gt;three&lt;/li&gt;&lt;li&gt;four&lt;/li&gt;
&lt;li&gt;five&lt;/li&gt;&lt;li&gt;six&lt;/li&gt;&lt;li&gt;seven&lt;/li&gt;
&lt;li&gt;eight&lt;/li&gt;&lt;li&gt;nine&lt;/li&gt;&lt;li&gt;ten&lt;/li&gt;
&lt;li&gt;eleven&lt;/li&gt;&lt;li&gt;twelve&lt;/li&gt;&lt;li&gt;thirteen&lt;/li&gt;
&lt;li&gt;fourteen&lt;/li&gt;&lt;li&gt;fifteen&lt;/li&gt;&lt;li&gt;sixteen&lt;/li&gt;
&lt;li&gt;seventeen&lt;/li&gt;&lt;li&gt;eighteen&lt;/li&gt;&lt;li&gt;nineteen&lt;/li&gt;
&lt;li&gt;twenty&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;


[i][size=4]c??thead[/size][/i]
Copy linkTweet thisAlerts:
@DaveSWFeb 05.2004 — what happens if the text causes a line break?
Copy linkTweet thisAlerts:
@cootheadFeb 05.2004 — ....Well in that case it can be done like this...
&lt;html&gt;
&lt;head&gt;
&lt;style type="text/css"&gt;
div
{
float:left;
width:20%;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;one&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;two&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;three&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;four &lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;five&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;six&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;seven&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;eight&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;nine&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;ten&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;eleven&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;twelve&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;thirteen&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;fourteen&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;fifteen&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;sixteen&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;seventeen&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;eighteen&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;nineteen&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;li&gt;twenty&lt;br /&gt;this has a&lt;br /&gt;LINE BREAK&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;


[i][size=4]c??thead[/size][/i]
×

Success!

Help @DanDigiMan 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...