Magento category dropdown menu - sub menu to be in 2 columns

Magento category dropdown menu - sub menu to be in 2 columns

August 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento category dropdown menu - sub menu to be in 2 columns

Magento Category Dropdown Menu: Displaying Sub-Menus in Multiple Columns

Introduction In Magento Community Edition v1.5, by default, the sub-categories under each main category are displayed in a single column when you hover over them. While this works fine for smaller sites, larger e-commerce stores may want to optimize their category layout further by displaying sub-menus in multiple columns.

Understanding the Default Behavior Magento’s standard dropdown menu uses CSS and JavaScript to create the hover effect. The catalog/category/view.phtml file is responsible for rendering the category tree. In this template, each sub-category is wrapped within a <li> element that automatically occupies a new line when displayed on the page.

Modifying the Template To modify the default behavior and display sub-categories in multiple columns, you’ll need to update the catalog/category/view.phtml file located under /app/design/frontend/<your-theme-package>/template/catalog/category/. Remember not to edit core files directly; instead, copy this template to your custom theme directory.

Implementing a 2-Column Layout To create a 2-column layout, you can utilize CSS Flexbox or Grid. Here’s an example using Flexbox:

<div class="category-tree-level-1">
    <ul style="display: flex; justify-content: space-between;">
        {% for child in child_categories %}
            <li class="category-tree-level-2">

                <!-- Category name and link -->

            </li>
        {% endfor %}
    </ul>
</div>

In this example, the ul element is given a Flexbox layout. The justify-content: space-between; property ensures that the child items (sub-categories) are evenly spaced across the available width.

Styling the Columns You’ll also need to add styling for the columns:

.category-tree-level-1 ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.category-tree-level-2 {
    flex: 1; /* Allows the item to take up an equal share of space */
    padding-right: 10px; /* Add some right padding for spacing between columns */

    &:last-child {
        padding-right: 0; /* Remove right padding from the last item */
    }
}

Conclusion By following these steps, you should now be able to display your Magento sub-categories in multiple columns when hovering over the main category. This can help improve the user experience and navigation on your site, especially for categories with a large number of sub-items.

Remember to test this change thoroughly across different browsers and devices, as CSS support may vary. If you require further assistance or advanced customization options, consider reaching out to an experienced Magento developer or support service like Laravel Company.

Catalog Performance Themes Admin

Our network