A
A
Anton Boyarsky2020-09-01 12:29:06
PHP
Anton Boyarsky, 2020-09-01 12:29:06

How to create a multi-level dropdown menu for a website?

Good afternoon, I want to write a multi-level drop-down menu for the store in the head of the website. I looked at the forums and youtube for different options for writing such a menu. Since there are many options, I would like to know which option is better for the following parameters:
1) adaptability
2) loading speed
3) functionality It is

better to write a static layout: pure html + css, bootstrap with css added, or make it more dynamic : in php, implementing everything through a loop to get the output of the elements: "Category", "Products", "About us", etc.? Prompt pzhl experienced typesetters.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Volf, 2020-09-01
@Antonio_1

All of the following is purely personal experience and opinion, does not claim to be true.

It is better to write a layout with a bias towards statics: on pure html + css,
I would write that way if possible. It should at least be faster than the same + JS.
on bootstrap with css added
It will most likely be faster in terms of obtaining the result, but there are big doubts about the quality of such a solution. In general, one of the rules of HTML'a / layout - if it is possible to implement something with a smaller number of elements - you need to do just that. That is, if it is physically possible to do something with one <div/>'a, and not two, three, etc. - you need to do it alone <div/>(without fanaticism, of course).
or make it more dynamic: in php, implementing everything through a loop to get the output of elements: "Category", "Products", "About us", etc.?
It directly depends on your tasks and needs. If you need the menu to be formed on the server, then it must be formed on the server. This does not apply directly to the layout. Personally, in my practice I use both approaches, and sometimes both at once (part of the menu is static, part is dynamic), depending on the desired result.
PS About the "functionality" I can not judge in the context of this question, but in terms of loading speed, - the option without Bootstrap and JS - should be as fast as possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question