In this tutorial you will learn how to create a responsive Header Template using the Container. It will be using four different widgets to best demonstrate how the flex properties can help you create headers that work across all devices without having to duplicate and hide as done in the past.
This tutorial will use several advanced flex properties such as Order and Size. You should have a basic knowledge of the Container properties before beginning this tutorial. The Site Logo, and Menu should also have been assigned and created.
You should begin by creating a new Header Template in the Theme Builder. You may close the library options and start from a blank slate.
A Site Logo, Nav Menu, Search Form, and Menu Cart widgets are used to make this example. You may use the Social Icons widget rather than the Menu Cart if WooCommerce is not installed.
Adding the parent container
You will now set the foundation of your Header by adding a Container. A Boxed width will be used for this tutorial but may be changed to Full if desired once completed if your design requires.
- Add a new Container by clicking the + icon
- In the Container Layout Tab, the default layout will be used in this tutorial
- Expand the Items properties accordion
- The Direction property will be set to Row
- Set the Align Items property to Center
- The Justify Content will be set to Flex End
- In the Style Tab, a Background color will be chosen. Using Global colors will save time a better workflow
- In the Advanced Tab a top and bottom padding is applied (example: 10PX)
Adding the widgets
The widgets will now be added to the container. Four widgets will be used to best demonstrate the Flex properties of Order and Grow.
Why backwards? Once the Justify Content property is set to Flex End, it is easier to drag widgets in reverse order. The Site Logo widget will also be using the Grow and Custom Width properties to best fill the remaining space in the later steps. Once you have learned these properties, you may adjust your workflow as desired.
The Menu Cart Widget
In this tutorial a Menu Cart widget will be used as it is a common need of many websites. If you are not using WooCommerce, You may substitute the Social Icons widget for your learning.
- From the Widget Panel drag and drop the Menu Cart (or Social Icons) widget to the Container. It will use the Flex-End property of the container to be right aligned
- In the Content Tab of the Menu cart, the Hide Empty, and Hide Subtotal are applied by using the toggle
- Set the widget’s Alignment to Center
- From the Style Tab, the Border is set to 0%. This will be inherited from the Button’s global styles
- In the Advanced Tab, navigate to the Order Property. Click the Custom order option and enter a value of four.
The Search Form widget
The Header is a good place to keep a search option. You may use the Full Screen option of the Search Form to create a functional, but minimalistic design, search capability for your visitors.
- From the Widget Panel, drag and drop the Search Form widget to the left of the Menu Cart
- In the Content Tab, select the Full Screen Skin option from the dropdown menu
- In the Style Tab, set the Toggle Icon background color to best match your design. Global colors are used to improve the workflow
- From the Advanced Tab, set the Order property to three.
The Nav Menu widget
Your website’s navigation may now be added using the Nav Menu widget. Your menus should already be created in WordPress.
- From the Widget Panel, drag and drop the Nav Menu widget to the left of the Search Form
- From the Content Tab set the Alignment property to Right using the icons
- In the Menu Dropdown options select the Full Width option using the toggle
- From the Advanced Tab, set the custom Order property to Two.
The Site Logo widget
You will now add the Site Logo widget to the container. It should be previously assigned in the Site Settings. If not, you should do so now and then return to the editor.
- From the Widget Panel drag and drop the Site Logo widget to the left on the Nav Menu
- Choose the Left Alignment property by selecting the Icon. you may only see a slight change, this is normal
- From the Advanced Tab, the Custom Order property is set to One
- You now use the Size property. Select the Grow option. This will allow the Site Logo to automatically fill the remaining space of the Container and will now be left aligned by inheriting the value in step two.
You will now learn to use the Custom Order property set in the widgets previously. This will allow you to change the order of each widget to best fit your design. This is a significant improvement over the reverse function previously available. It may allow you to avoid creating separate headers for each device.
In the Table View, the Nav Menu and Menu Cart’s Order property will be revered using the Custom Order property. In order for these properties to be used they must be first set in the Desktop View earlier. If you have not set the order of a widget to a custom value, do so before switching the device views.
- From the Container Layout Tab, adjust the width of the Boxed content (example: 90%)
- Select the Nav Menu widget. In the Advanced Tab, you will now change the custom Order property to Four. Since the other items are inheriting their desktop view, it may not yet show in its proper location. This is normal
- Next select the Menu Cart (or Social Icons) widget. Set the custom Order property to Three
- Finally select the Search Form icon and set the custom Order property to Two (may already be in the correct location)
- The Site Logo widget will retain the inherited Order value of One.
For the mobile breakpoint, we will use the Wrap along with Justify Content properties of the Container. A Custom Width property is applied to the Site Logo to center it above the other three widgets.
- From the Layout Tab of the Container, expand the Items accordion
- Apply the Wrap property by clicking the icon
- Change the Justify Content property to Space Between
- Adjust the Container Width property to allow for some left and right margin (example: 95%)
- Finally, select the Site Logo widget
- In the Content Tab, change the Alignment to Center using the icon
- In the Advanced Tab, change the Width property to Custom using the dropdown menu
- Adjust the width of the Site Logo widget to 100%
You should now be able to create responsive Header Templates using the Container. You may now experiment with using different widget combinations and orders to wow your visitors.
Optional social icons
Here, the optional Social Icons widget mentioned in the tutorial above is shown to demonstrate.
Now that you’ve seen how to build a Header template, check out how to build a template for the footer that will appear at the bottom of your site’s pages.
To get the most out of Elementor, check out the Elementor Academy for helpful learning resources. If you come across any issues or need help, please contact our Support Center.