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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Multi Column Menu : how to?


Go to End


3 Posts   1510 Views

Avatar
pinkp

Community Member, 182 Posts

12 January 2013 at 3:22am

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

Community Member, 22 Posts

13 January 2013 at 1:33am

Edited: 13/01/2013 1:36am

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

Community Member, 182 Posts

13 January 2013 at 11:32am

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