Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting a list into two columns in CSS

Tags:

css

styling

I can't figure out how to get my list into a two column list. I tried some of the examples in other similar questions but it just doesn't change anything.

<div class="section" id="skillset">
<h1>SKILL SET:</h1>
<h2>Have passed classes which taught all of the following:</h2>
<ul class="skills">
    <li>Intermediate Spanish</li>
    <li>Microsoft Word</li>
    <li>Microsoft Power Point</li>
    <li>Microsoft Excel</li>
    <li>Dreamweaver</li>
    <li>Adobe Photoshop</li>
    <li>CAD Lab</li>
    <li>Visual Basic</li>
    <li>C++</li>
    <li>Java</li>
</ul>
</div>

I'd like to have 5 items in the list then another 5 to the right of it.

Due in one hour :(

like image 567
Ballin Avatar asked Feb 11 '14 04:02

Ballin


People also ask

How do you split a list in CSS?

The list items can be separated with a margin on the "LI" element. In this case margin of "0.2em" was applied to the bottom of the "LI".


2 Answers

column-count can surely help you here.

Just add the following CSS

.skills
{
    -moz-column-count: 2;
    -moz-column-gap: 2.5em;
    -webkit-column-count: 2;
    -webkit-column-gap: 2.5em;
     column-count: 2;
     column-gap: 2.5em;
}

but do check the browser support as it will not work in older versions of IE

Here is a Fiddle demo of working code

like image 51
Saurabh Avatar answered Oct 18 '22 13:10

Saurabh


Inside your CSS code things, put this:

.skills {
/* other codestuff */
column-count: 2;
}

I hope this is sufficient.

like image 38
user2921024 Avatar answered Oct 18 '22 13:10

user2921024