Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

Multi Column Menu : how to?


Reply

3 Posts   532 Views

Avatar
pinkp

12 January 2013 at 3:22am Community Member, 168 Posts

Doesn't any one have a good way to create a menu which splits in to columns?
Ie. 9 links in a set of 3 columns...

I don't think it can be achieved with CSS alone?
Might need some code to maybe split it up after every 3 and place in a new div? Any ideas?

Thanks PP

Avatar
kaanuni

13 January 2013 at 1:33am (Last edited: 13 January 2013 1:36am), Community Member, 22 Posts

Well i do exactly that in a responsive site, when the screen width goes below a certain threshold. I just set the width of my left floated <li>'s to 33.33%. But in ss3 you could also use the template conditional <%if MultipleOf(3)%><% end_if %> within your loop to the same effect. Look here:

http://doc.silverstripe.com/framework/en/3.1/reference/templates#modulus-and-multipleof

Avatar
pinkp

13 January 2013 at 11:32am Community Member, 168 Posts

Great! Float the li left! OK that was a lot easier than I thought... thanks