Note that there are some explanatory texts on larger screens.

plurals
  1. POFormatting a horizontal list of lists, how to fix the height of dynamic html
    primarykey
    data
    text
    <p>I'm creating a Site Map type of menu to sit at the bottom of the page, giving quick access to the first two levels of the site structure. However I'm having trouble formatting the lists so they neatly display when wrapped.</p> <p>Here's a picture of what I'm trying to get to: <img src="https://i.stack.imgur.com/VeUWq.png" alt="Desired footer menu layout"></p> <p>However, what I end up with looks like this: <img src="https://i.stack.imgur.com/gOmac.png" alt="Badly formatted list"></p> <p>Here's the code simplified to show the problem, and a link to a <a href="http://jsfiddle.net/PV8Bq/" rel="nofollow noreferrer">JSFiddle</a></p> <pre><code>&lt;html lang="en"&gt; &lt;head&gt; &lt;style type="text/css"&gt; #footer-menu { float:left; background:#454545; color:#FFFFFF; width:850px; margin:50px auto 0 auto; padding:10px 10px 2px 10px; display:inline; } #footer-menu ul { padding:0; list-style-type:none; left:auto; overflow: auto; } #footer-menu li { margin:0 20px 5px 0; padding-left:6px; list-style-type:none; float:left; display:inline; background:none; position:relative; font-family:Arial; font-weight:bold; border-left:1px solid #FFFFFF; } #footer-menu ul li ul { margin:5px 0 5px 0; } #footer-menu ul ul li { float:none; padding:0; margin:0 0 2px 0; font-weight:normal; display:block; width:auto; border:0; } #footer-menu a { text-decoration: none; color: white; } #footer-menu a:hover { text-decoration: underline; color: white; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="footer-menu"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Title is quite looooong&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 4&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 5&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 6&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 7&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 1 Item 8&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Short title&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 4&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 3 Title of average length&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;List 3 Item 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 3 Item 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 3 Item 3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 4 with no sub items&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 5 Should wrap under list 1&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;List 2 Item 4&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The items in the list come from the site map XML file via a script to generate the HTML, the list will change as pages are added to the site, so I'm looking for a solution which will not require me to manually adjust the height of the lists in order for it to format correctly.</p> <p>Is it possible, using CSS, to fix the height of the entire row of lists so any wrapped list starts on the left hand side of the new row?</p>
    singulars
    1. This table or related slice is empty.
    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