Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is no pure CSS/HTML way to achieve this, as far as I know. Your best bet would be to do it in pre-processing (<code>if list length &gt; 150, split into 3 columns, else if &gt; 70, split into 2 columns, else 1</code>). </p> <p>The other option, using JavaScript (I'm not familiar with the <a href="https://jquery.com/" rel="nofollow noreferrer">jQuery</a> library specifically) would be to iterate through lists, probably based on them being a certain class, count the number of children, and if it is a high enough number, dynamically create a new list after the first, transferring some number of list items to the new list. As far as implementing the columns, you could probably float them left, followed by an element that had the style <code>clear: left</code> or <code>clear: both</code>.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.column { float: left; width: 50%; } .clear { clear: both; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ul class="column"&gt; &lt;li&gt;Item 1&lt;/li&gt; &lt;li&gt;Item 2&lt;/li&gt; &lt;!-- ... --&gt; &lt;li&gt;Item 49&lt;/li&gt; &lt;li&gt;Item 50&lt;/li&gt; &lt;/ul&gt; &lt;ul class="column"&gt; &lt;li&gt;Item 51&lt;/li&gt; &lt;li&gt;Item 52&lt;/li&gt; &lt;!-- ... --&gt; &lt;li&gt;Item 99&lt;/li&gt; &lt;li&gt;Item 100&lt;/li&gt; &lt;/ul&gt; &lt;div class="clear"&gt;</code></pre> </div> </div> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload