- This topic has 9 replies, 2 voices, and was last updated 4 years, 3 months ago by lisia.
-
AuthorPosts
-
July 24, 2020 at 8:03 pm #11605lisiaParticipant
Hello!
I would like to have the sticky header with a background image (my header image) instead of the choosen color in the customizer. Do you have an additional code for this?
I like Cordero very much!!!
Best regards, lisia
July 24, 2020 at 8:38 pm #11606lisiaParticipantSorry … I see, it is the background image on the pages, but I also want to have this behaviour also on the start-site.
lisia
- This reply was modified 4 years, 3 months ago by lisia.
July 24, 2020 at 8:51 pm #11608lisiaParticipantI can explain it better now: I want to have the background image on the scrolled header also on sites, where I use the template “transparent header”. In the moment, there i have the color, which can be adjusted in the customizer.
Kind regards, lisia
July 25, 2020 at 9:43 am #11609lisiaParticipantI found part 1 of a solution with the following code:
#masthead.scrolled{
background-image: url(http://….)
}But I also need the gradient overlay … either the gradient overlay always or never.
BR, lisia
July 25, 2020 at 9:43 am #11610lisiaParticipantMaybe I have found the solution by myself:
In the additional code I set the url of the header
#masthead.scrolled{
background-image: url(http://……..jpg)
}Then I edited the page with the transparent header, the cover block – and there I could adjust the overlay.
Is my solution ok or is there a better way?
Best regards, lisia
July 25, 2020 at 11:35 am #11615AndyKeymaster“I would like to have the sticky header with a background image (my header image) instead of the choosen color in the customizer. Do you have an additional code for this?”
You could add a header image in ‘Customize’ > ‘Header Image’
and then to make the image only appear when scrolling down the page add this ‘Additional CSS’:
#masthead:not(.scrolled) { background-image: none !important; }
July 25, 2020 at 11:42 am #11616AndyKeymasterYes, the CSS code you wrote is another way of doing the same thing.
About the overlay, I’m not sure whether you want the overlay on the cover block or on the header image, as they are two different things.
The cover block overlay is easy to do as there are options in the block editor for this.
July 25, 2020 at 12:12 pm #11619AndyKeymasterTo give the scrolled header image a semi-transparent color overlay, us this CSS:
#masthead.scrolled:before { position: absolute; top: 0; right: 0; bottom: 0; left: 0; height: 100%; width: 100%; content: ""; background: red; opacity: 0.5; }
July 25, 2020 at 10:23 pm #11624lisiaParticipantBecause the overlay in the original code and also with your additional code is over the logo, I have decided, not to use any overlay at all. I prepare my images before I use them.
Thank you nevertheless for the code. Kind regards, lisia
July 25, 2020 at 10:30 pm #11623lisiaParticipantHello Andy!
Thank you for so many answers. This code
#masthead:not(.scrolled) {
background-image: none !important;
}doesn’t solve my problem. I want the header with the image everywhere, but I don’t want the plain coloured header in the transparent-header-template like the following picture (picture1) shows.
But it doesn’t matter – my solution is working (picture2).
Best regards, lisia
-
AuthorPosts
- The topic ‘Sticky header with background image’ is closed to new replies.