SHARE
A shrinking header is a modern website feature that enhances user experience while maintaining navigation accessibility. This guide will walk you through creating a responsive, shrinking header using Elementor Pro’s built-in features and custom CSS, ensuring optimal performance across all devices.
Essential Requirements
– WordPress website
– Elementor Pro (Advanced plan or higher)
– Basic understanding of WordPress dashboard
Begin by navigating to your WordPress dashboard and accessing Templates > Theme Builder.
Create a new header template by adding a full-width container with centered alignment. The basic header structure should include:
– Logo/Site image
– WordPress menu
– Call-to-action button
The magic happens in the container’s advanced settings:
1. Set a high Z-index value to keep the header above other elements
2. Add a custom class name (e.g., “shrink-header”)
3. Enable Motion Effects
4. Configure the sticky effect for desktop view
5. Set an effects offset (recommended: 100-150 pixels)
For proper shrinking behavior, assign specific classes to your header elements:
– Logo/image: “logo” class
– Menu: “menu” class
– Button: Uses default Elementor button class
The shrinking effect relies on CSS transitions. Key styling areas include:
– Initial header state (background, height, transparency)
– Shrunk header state (reduced dimensions, color changes)
– Element transitions (logos, buttons, menu items)
– Blur effects (optional)
– Transition timing (recommended: consistent timing across elements)
Create a separate container for mobile displays:
1. Hide desktop container on mobile/tablet
2. Configure mobile-specific sticky settings
3. Adjust layouts for smaller screens
4. Implement separate CSS rules for mobile breakpoints
Several aspects can be customized to match your design:
– Transition speeds
– Header heights
– Background opacity
– Text and button sizes
– Color schemes
– Blur effects
Before finalizing:
1. Test the header across different screen sizes
2. Verify smooth transitions on actual devices
3. Check for any potential conflicts with other elements
4. Ensure consistent behavior across different pages
– Maintain consistent transition timing
– Use appropriate offset values
– Test on real devices
– Consider user experience at all scroll positions
– Optimize for performance
The shrinking header effect adds a professional touch to your website while maintaining functionality. By using CSS-only animations, you ensure smooth performance without the overhead of JavaScript. Whether you’re building a business website or a personal portfolio, this feature enhances the overall user experience while keeping your navigation accessible and stylish.
Remember to test thoroughly across different devices and screen sizes to ensure consistent behavior. The beauty of this implementation lies in its simplicity and flexibility – you can easily adjust colors, sizes, and transitions to match your website’s design language while maintaining professional functionality.
Add this code into your WordPress Custom Code, Elementor Custom Code or in the Main Widget of your Page. (Best option Worpdress Custom Code, to have everything woll organized. )
/* shrinking header section */
.shrink-header {
background:rgba( 255, 255, 255, 0.01 );
backdrop-filter: blur( 25px );
height: 15vh !important;
transition: all .5s linear!important;
}
.shrink-header.elementor-sticky--effects {
background: rgba(199, 199, 199, 0.68);
height: 10vh !important;
backdrop-filter: blur( 50px );
padding-top: 2px!important;
padding-bottom: 2px!important;
transition: all .5s linear!important;
}
/* shrinking header section */
.elementor-button {
padding: 15px 40px!important;
font-size: 1.2rem !important;
transition: all .5s linear!important;
}
.shrink-header.elementor-sticky--effects .elementor-button{
padding: 12px 32px!important;
font-size: 1.1rem !important;
transition: all .5s linear!important;
}
/* Shrinking menu with Font-sizes */
.menu {
font-size: 1.2rem !important;
transition: all .3s linear!important;
}
.shrink-header.elementor-sticky--effects .menu{
font-size: 1.1rem !important;
transition: all .3s linear!important;
}
/* Changing color of the menu items */
.shrink-header.elementor-sticky--effects .elementor-nav-menu a{
color: #333 !important;
transition: all .3s linear!important;
}
/* shrinking logo image */
.logo img {
width: 8vh !important;
transition: all .5s linear!important;
}
.shrink-header.elementor-sticky--effects img {
width: 7vh !important;
transition: all .5s linear!important;
}
/* Tablet and Mobile Menu Shrinking */
@media screen and (max-width: 1024px) {
/* shrinking background */
.shrink-header.elementor-sticky--effects {
height: 8vh !important;
padding-top: 2px!important;
padding-bottom: 2px!important;
transition: all .5s linear!important;
}
/* shrinking image */
.shrink-header.elementor-sticky--effects img {
width: 6vh !important;
transition: all .5s linear!important;
}
/* shrinking menu */
.shrink-header.elementor-sticky--effects ul li a {
font-size: 1rem!important;
font-color: black;
transition: all .5s linear!important;
}
/* shrinking button */
.shrink-header.elementor-sticky--effects .elementor-button {
padding: 10px 32px!important;
transition: all .2s linear!important;
}
}
@media screen and (max-width: 460px) {
/* shrinking background */
.shrink-header.elementor-sticky--effects {
height: 8vh !important;
padding-top: 2px!important;
padding-bottom: 2px!important;
transition: all .5s linear!important;
}
/* shrinking image */
.shrink-header.elementor-sticky--effects img {
width: 5vh !important;
transition: all .5s linear!important;
}
/* shrinking menu */
.shrink-header.elementor-sticky--effects ul li a {
font-size: 1rem!important;
font-color: black;
transition: all .5s linear!important;
}
/* shrinking button */
.shrink-header.elementor-sticky--effects .elementor-button {
padding: 10px 32px!important;
transition: all .2s linear!important;
}
}