Header Padding: Conditional HTML

11 months ago

< 1 min read

Posted by:

Focus

Subscribe to newsletter

By subscribing you agree to with our Privacy Policy.

Share

If you want to have conditional padding for your header, give your header the CSS class .mainheader and add an HTML widget to your page (not the header). Paste the following code into your HTML widget:

<script>
function adjustMainHeaderPadding() {
    if (window.innerWidth <= 767) {
        var mainHeader = document.querySelector('.mainheader');
        if (mainHeader) {
            mainHeader.style.paddingLeft = '15px';
            mainHeader.style.paddingRight = '15px';
        }
    }
}

// Run the function when the page loads
window.addEventListener('load', adjustMainHeaderPadding);

// Also run the function when the window is resized
window.addEventListener('resize', adjustMainHeaderPadding);
</script>

Read more

Video

< 1 min read

Elementor Custom Video Lightbox CSS

Add this code on Appearance Customize > Additional CSS :

Read more

Media Carousel

< 1 min read

Media Carousel Random Order

Add this code in HTML widget to randomize the ‘Media Carousel’ order.

Read more

Video

< 1 min read

How to Make Play Icon on Image Overlay Smaller (Elementor Video Playlist Widget)

If you activate the image overlay, there is an option to show play icon. And the default play icon for

Read more

Global

3 min read

Improve the Quality of the Scrolling Experience with Custom CSS Scrollbars

Hello guys! Have you ever thought about how to improve the appearance of the scrollbar on your website page? A good scrollbar

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, July 31

Hi, there 👋

How can I help you?

Start Chat with:

We use cookie to improve your experience on our site. By using our site you consent cookies.