Jump to content

Dynamic Header for Home Page Only

Go to solution Solved by tuanphan,

Recommended Posts

  • Solution
Posted

You mean homepage header should be transparent?

Add to Design > Custom CSS

body.homepage article section:first-child {
    padding-top: 0px !important;
}
body.homepage .header-background-solid {
    background-color: transparent !important;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • 10 months later...
Posted
On 8/29/2022 at 3:03 AM, tuanphan said:

You mean homepage header should be transparent?

Add to Design > Custom CSS

body.homepage article section:first-child {
    padding-top: 0px !important;
}
body.homepage .header-background-solid {
    background-color: transparent !important;
}

 

Can you add in code to still make it black when you scroll similar to all my other pages?

Posted
16 hours ago, EmilyMMorris said:

Can you add in code to still make it black when you scroll similar to all my other pages?

Use this

body.homepage article section:first-child {
    padding-top: 0px !important;
}
body.homepage .header-background-solid {
    background-color: transparent !important;
}
body.homepage header#header.shrink {
	background-color: black !important;
}

If it doesn't work, please share link to your site, we can check easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted

Hey @tuanphan, thanks for your answers.

I'm trying to do the same –make the header transparent– in another page which is not the homepage. In my website I've called it "Reservations".

I've tried to change "body.homepage" to "body.reservations" but it doesn't work.

How should I tweak the code?

Thanks!

Posted
1 hour ago, Rosamante said:

Hey @tuanphan, thanks for your answers.

I'm trying to do the same –make the header transparent– in another page which is not the homepage. In my website I've called it "Reservations".

I've tried to change "body.homepage" to "body.reservations" but it doesn't work.

How should I tweak the code?

Thanks!

Only home has .homepage, other pages will use random id. Can you share link to Reservations page?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted
17 hours ago, Rosamante said:

Use this code

body#collection-64a916228a47db6a5ed7e77e {
article section:first-child {
    padding-top: 0px !important;
}
.header-background-solid {
    background-color: transparent !important;
}
header#header.shrink {
	background-color: black !important;
}}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • 2 months later...
Posted

I'm trying to use the code @tuanphan provided to do exactly what OP was trying to achieve. But this code unfortunately isn't working for me.

body.homepage article section:first-child {
    padding-top: 0px !important;
}
body.homepage .header-background-solid {
    background-color: transparent !important;
}

My website is: eshertennis.co.uk


I would like my homepage to have a dynamic header, and every other page to have the solid header with the colour prescribed in global site styles (hex: #153643). Can anyone help?

Posted (edited)
On 9/13/2023 at 10:11 PM, jbassett said:

I'm trying to use the code @tuanphan provided to do exactly what OP was trying to achieve. But this code unfortunately isn't working for me.

body.homepage article section:first-child {
    padding-top: 0px !important;
}
body.homepage .header-background-solid {
    background-color: transparent !important;
}

My website is: eshertennis.co.uk


I would like my homepage to have a dynamic header, and every other page to have the solid header with the colour prescribed in global site styles (hex: #153643). Can anyone help?

You can set dynamic header, then use this code to change color on other pages

body:not(.homepage) header#header {
    background-color: #153643 !important;
}
Edited by tuanphan
missing class name

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Posted
2 hours ago, tuanphan said:

You can set dynamic header, then use this code to change color on other pages

body:not(.homepage) header#header {
    background-color: #153643 !important;
}

I don't know how you know the solution every single time @tuanphan but I am extremely grateful. Thank you so much.

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.