Note that there are some explanatory texts on larger screens.

plurals
  1. POFloating Dynamic Multi-Line List Items into Two Columns
    primarykey
    data
    text
    <p>I have a dynamic list that I need to lineup nicely into 2 columns using CSS and I'm having a terrible time with it.</p> <p>The markup similar to this:</p> <pre><code>&lt;ul&gt; &lt;li&gt;A is for apples&lt;/li&gt; &lt;li&gt;B is for bananas which are yellow in color&lt;/li? &lt;li&gt;C is for cupcakes&lt;/li&gt; .... &lt;/ul&gt; </code></pre> <p>When I simply give the li's a width and float them to the left they are clearing funny and end up formatted similar to this:</p> <pre><code>A is for apples B is for bananas which are yellow in color C is for cupcakes D is for dirtbag </code></pre> <p>I need the formatting to get the 3rd li directly under the first li - no matter the height of any one of the list items like this:</p> <pre><code>A is for apples B is for bananas which C is for cupcake are yellow in color D is for dirtbag </code></pre> <p>Each li's text is being pulled from a database and I have no control over how long each is.</p> <p><em>Clarification Update</em> - The list may also come out of the database like so:</p> <pre><code>&lt;ul&gt; &lt;li&gt;A is for apples that grow on trees&lt;/li&gt; &lt;li&gt;B is for boat&lt;/li&gt; &lt;li&gt;C is for cupcakes&lt;/li&gt; &lt;li&gt;D is for dishes - that sure don't wash themselves&lt;/li&gt; .... &lt;/ul&gt; </code></pre> <p>Requiring the formatting:</p> <pre><code>A is for apples that B is for boat grow on trees C is for cupcake D is for dishes - E is..... that sure don't wash themselves </code></pre> <p><em>/clarification</em></p> <p><strong>My backup plan</strong>: The order is not particularly relevant so I have tried to split the list in half and print out the two columns in 2 separate <code>&lt;ul&gt;</code>'s that floats left with a defined width but with each <code>&lt;li&gt;</code>having a variable height and the database returning between 2-15 items, using that method the bottom of the columns don't consistently look even. I'd just rather find a better option if possible :/</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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