• Resolved vytaulla51

    (@vytaulla51)


    Hi:

    I need to rebuild & update this site in Gutenberg. I understand I can use the cover block for a background image that would fill a page, but what if I want the bg image to start at the very top and be behind the site-title and navigation too? If I use the cover block in the header template and set it to 100% VH it pushes the page content down. If I put template content inside the header-template cover block it then applies to all templates. So that leads to doing multiple headers…

    Is it down to CSS at this point? Or multiple headers?

    Thanks!

    • This topic was modified 9 months ago by vytaulla51.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator jordesign

    (@jordesign)

    Hey @vytaulla51 – that does indeed sound like a little but of a tricky situation. It would help if you could explain a little more what the end result you’re hoping for is…

    is the end goal to have a different background image for each page/post?

    Thread Starter vytaulla51

    (@vytaulla51)

    Hi:

    No, the end goal is for the same background image to be on every page – and is behind the navigation too. See sample link.

    Thanks!

    Moderator jordesign

    (@jordesign)

    Hey @vytaulla51 – thanks for clarifying. To do something like that what I’d recommend is that in your Page template(s) you have a group block outside the Header, content, and footer – and you can apply the background to the Group.

    So you’d have something like:

    – Group Block (with background)
    – Header template part
    – Content
    – Footer template part

    Could you try something like that to see how it goes?

    Thread Starter vytaulla51

    (@vytaulla51)

    Hi Jordesign!

    Why didn’t I think of that??? I placed the cover block at the top of each template with the background image and put the header, content, footer template-parts inside it. That seemed to work!

    Couple of questions:

    1. Cover block doesn’t have a background-color setting — when styling themes via CSS I always had both a background-color in addition to a background-image in case the image didn’t load. Should I do that here? Do I need to place everything inside a group block just for the background-color?

    2. You suggested using a group block which allows for background-color but not background-image. Was that because of question 1? Or is there some other reason?

    3. The Group block has a sticky option – can that be used to create a sticky navigation?

    Thanks, thanks, thanks!

    Moderator jordesign

    (@jordesign)

    Hey @vytaulla51

    1. Cover block doesn’t have a background-color setting — when styling themes via CSS I always had both a background-color in addition to a background-image in case the image didn’t load. Should I do that here? Do I need to place everything inside a group block just for the background-color?

    Good point – I’ve used the overlay color in that case (if I wanted a background color) but that wouldn’t work as a fallback. Another option would be to use

    – Group (with background color)
    – Cover (with background image).

    2. You suggested using a group block which allows for background-color but not background-image. Was that because of question 1? Or is there some other reason?

    Ah yes – as of the latest version of Gutenberg (16.7) background images are possible on Group blocks – so updating to that version may be the quickest option.

    3. The Group block has a sticky option – can that be used to create a sticky navigation?

    The answer to that is yes… but….

    Sticky positioning currently works on top-level blocks (so they’re the very outer block in a template). So you could make a Group (which then contained a header) sticky and you’d get sticky navigation.

    But in your case – because your outer-most block is the one containing everything – setting it to Sticky would make the whole site sticky…. which seems like it’s not something you’d really want 🙂

    Thread Starter vytaulla51

    (@vytaulla51)

    Hi:

    Re: the sticky menu – no, I don’t want to have one on the sample site – I just wanted to confirm it’s possible for other sites if needed.

    Thank you for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How make bg image include both header and page?’ is closed to new replies.