--- title: "Pages Widget (Mega Menu) Layout" slug: "pages-widget-mega-menu-layout" description: "Understand how the Pages Widget algorithm balances menu items into columns in Municipal Websites Evolve. Learn the key constraints affecting column layout, how the algorithm works, and tips for optimizing results by adjusting the number of columns." updated: 2025-08-12T18:14:25Z published: 2025-08-12T18:14:25Z canonical: "www.civicplus.help/pages-widget-mega-menu-layout" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://www.civicplus.help/llms.txt > Use this file to discover all available pages before exploring further. # Pages Widget (Mega Menu) Layout When creating columns of approximately even length concerning the pages widget, the following constraints and contributing factors are outside the control of the algorithm doing the balancing: - Number of columns - Order of menu item groups - Total number of items - Relative size (number of child items) of item groups - Font-size difference between 1st and 2nd-level items - Text wrapping for items with longer menu text - If one column must be longer, it should be the left-most - Performance: We need to generate results in a time frame acceptable to a modern web user Within these constraints, we need to create a single algorithm that will be used for all possible configurations. We have yet to identify an algorithm that will result in ideally balanced columns for all configurations. ## Our Algorithm 1. Count the number of total items (at all levels) 2. Divide that total by the number of columns > [!WARNING] > **Note**: > > The result is the target number of items in any given column. 3. We fill the columns from right to left At present, the best solution is to adjust the number of columns to that which yields the best result.