Jump to content

is it possible? Find the number of list items and split into 2 cols


peppericious
Go to solution Solved by kicken,

Recommended Posts

I have a "vocab list" on a page in the form of a ul with li items.

The number of vocab entries (li items) varies. I'd like to display the vocab in two adjacent columns.

 

For argument's sake, suppose there are 19 items in the list, like this:

<ul>
<li>blah</li>
<li>blah</li>
<li>blah</li>
<li>...</li>
</ul>

Is there a way of counting the number of li items, splitting the list in two, and then displaying the content like this, in two divs:

<div>Col 1
<ul>
<li>blah</li>
<li>blah</li>
<li>blah</li>
<li>blah</li>
</ul>
</div>

<div>Col 2
<ul>
<li>blah</li>
<li>blah</li>
<li>blah</li>
</ul>
</div>

Frankly, I have no idea how to go about this. Thanks in advance if anyone can shed light for me...

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.