arrow_back How to create a menu?

1 vote
There is a menu like this:

This submenu appears when you hover over the catalog item. Everything seems simple, 3 columns. And how to create such that, for example, when you pull on WordPress or other CMS, all this work? So you could just set a fixed width, position absolute, and 3 columns with float left or inline-block... And how to be when you don't know in advance the number of columns, their height...

2 Answers

1 vote
Most likely, the menu will be formed from an array. If you know the sequence number of the element, and if it is divisible by a certain number without a remainder, you close the column and create a new one.
Roughly it looks like this.
<? $i=1 ?>
<? foreach ($arMenu as $menu){ ?>
if ($i%5==0){
<? }?>
every 5 points ul will be closed and a new one will be opened.
1 vote