How to make initial header transparent and opaque on scroll

You can make the header sit over the content below it using the page header metabox. This is good for achieving a layout where the background image stretches.

This is good until you get past this section and you need the header to go opaque so that the white text is still visible. You can achieve this with a little bit of CSS and using the built in metabox header option on the page editor page.

In the SCSS file in your child theme, set the $header-bg CSS variable to transparent. Then add this CSS to activate the

#tri-header {
    box-shadow: none;
    .header-on-top & {
        background: transparent;
    }
}


Joseph Chesterton

Published by

Co-founder and Managing Director at Web3. You’ll find me taking care or all the technical and developmental aspects at Web3. I ensure every WordPress website we build is powerful and high performing so that you can have the fastest and best website investment possible.

Leave a Reply

Your email address will not be published. Required fields are marked *