Header Padding: Conditional HTML

1 year 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

Search Results

< 1 min read

Search Result Custom Order

To add this code, go to Dashboard > Appearance > Theme File Editor and add one of these codes at

Read more

Video

< 1 min read

How to Get Youtube API and Check Quotas

How to get Youtube API:Go to: https://console.cloud.google.com/apis/dashboard How to check Youtube API Quota:Go to: https://console.cloud.google.com/iam-admin/quotas

Read more

Video

< 1 min read

Elementor Custom Video Lightbox CSS

Add this code on Appearance Customize > Additional CSS :

Read more

Troubleshoot

< 1 min read

How to Fix Custom Fields Not Showing in WordPress (Crash with ACF Plugin)

If custom field is not showing when ACF plugin is activated, go to Dashboard > Themes > Themes File Editor,

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, August 30

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.