I need help with my CSS submenu arrangement. I’m trying to achieve a mega menu that will accommodate as many sub-menus and items as possible. So far, this is what I have: https://jsfiddle.net/Kiwin/kspLfze5/1/
Under Category1 Sub3, I’m trying to make Item6 the last of it’s column so that Item7-9 start next to Item1-3 (upper right corner). Thanks for any help.
It would be helpful if you could tidy up your JSFiddle somewhat. Pls remove the <head> section from the HTML pane (no need for that) and also remove the <script> tags from the bottom of the pane — the HTML panel is only for, well, HTML.
Also, all of the assets point to http://localhost, which we don’t have access to (as that is your PC).
The best thing to do really, would be to remove any scripts or styling that isn’t relevant to the problem in hand and give us a short, runnable demo demonstrating your issue.
If I understand correctly then you are wanting the items to wrap to a new column once they reach the bottom of their container. This is quite awkward and I think the closest you can get is to use CSS columns but you will need to give the items a width so that there is room for more than one column and the parent will need a height otherwise the browser won;t know where to start the new column…
e.g. Something like this:
.menu ul ul {
background: #000;
visibility: hidden;
opacity: 0;
position: absolute;
transition: all 1s ease;
left:60%;
top: 0%;
/*bottom: -50%;*/
column-width:100px;
-moz-column-fill: auto;
column-fill: auto;
height:100%;
}
You could use flexbox to fill columns automatically also but the problem would be that any orphaned items would stretch to full height and look odd.
Hi PaulOB,
My initial aim was to put up a big menu that would accommodate as many subcategories and items as possible for each main category. I’ve just made some improvement thanks to your contribution. I’ve been trying since to figure out how to make Sub3 Item1’s sentence fit without breaking. Reducing font-size makes it fit but letters become too tiny. Any help or suggestion? Thank you so much. Latest fiddle is: https://jsfiddle.net/Kiwin/0muhjp3y/