Sticky header
-
Dear Anders,
what an amazing new Theme poe is. I have only one question: How do I get a sticky header like in Chaplin. That was very responsive that time.
Yours
Ivo
-
Hi @ivohuber,
Glad you like it! The Site Editor doesn’t have any built-in options for sticky elements. It’s possible to make it sticky with custom CSS, but the exact CSS will depend a little bit on how your header is structured. I can post the CSS for your current setup if you post a link to your site.
— Anders
Dear Anders,
that would be wonderful!
Actually my website is running with Chaplin and I would like to change to a full site editing theme with more possibilities. As far as I see Poe brings me to what I want.
You will find my website here: https://www.ivohuber.de
If I may ad a further wish? I have never worked with CSS therefore I would appreciate it if you could give an advice where I get the necessary information to ad the CSS you kindly will provide.
Ivo
Hi @ivohuber,
The following CSS should work with the default structure of the Poe header (the one used on the demo site). It might break if the header is changed, so that’s something to keep an eye out for when you adjust the header in the Site Editor.
.wp-site-blocks { padding-top: calc( ( var( --wp--custom--spacing--outer ) * 2 ) + 1em ); } .site-header { background-color: var( --wp--preset--color--background ); position: fixed; top: 0; width: 100% !important; z-index: 999; }
Any custom CSS plugin will do, like this one: https://www.ads-software.com/plugins/simple-custom-css/
— Anders
Dear Anders,
thank′s a lot. Simple CSS works fine. What a wonderfull, easy to handel tool!
But I do get the message that the CSS provided wan′t work. When I tip: background-color:var (–wp–preset–color–background); is says: ! Exspected (<color>) but found
var (--wp--preset--color--background)
. Also the result on my Testpage is funny: https://www.test.ivohuber.de as you can see.What do I make a wrong?
Ivo
Hi @ivohuber,
It’s possible that the plugin I linked to doesn’t support CSS variables, so you might have better results trying a different custom CSS plugin.
— Anders
Hi Anders,
I got the CSS now in with the plugin “WPCode – Insert Headers, Footers, and Code Snippets” but the result is not as I want it: https://www.testivohuber.de as the header apears double now.
Sorry to make so much hassle! Just to informe you: I deleted de page completedly to start afresh as I wasn′t shure wether the CSS I inserted with the previous plugin would be still aktive.
What can I do?
Ivo
Hi @ivohuber,
It’s not the header that appears twice, but the footer that is visible below the header. Try changing the CSS I posted to the following:
.wp-site-blocks { padding-top: 6em; } :root .site-header { background-color: var( --wp--preset--color--background ); position: fixed; top: 0; width: 100% !important; z-index: 999; }
— Anders
You are abselutely right! Header and Footer o.k. now. Unfortunetely the header won′t be sticky. What do I miss out?
Ivo
@ivohuber It looks like you’ve removed the custom CSS – I can’t see it being loaded on the front-end anymore.
I double checked everything. The CSS added at the moment is:
.wp-site-blocks { padding-top: 6em; } :root .site-header { background-color: var( --wp--preset--color--background ); position: fixed; top: 0; width: 100% !important; z-index: 999; }
only.
Did I forget anything?
Ivo
@ivohuber The CSS you’ve posted here is correct, but there are some misspellings in the CSS that you’ve added on your site. This is what is output in the HTML:
.wp-site-blocks{ padding-top:6em; } :root.side.header { background-color:vor(--wp--preset--color--background); position: fixed; top:0; width:100% !important; z-index:999; }
Note the
:root.side.header
part, which should be:root .site-header
.Edit: Oh, and
vor(--wp--preset--color--background);
should bevar(--wp--preset--color--background);
.- This reply was modified 2 years, 2 months ago by Anders Norén.
Sorry, again, but it doesn′t work. Here again the current CSS:
.wp-site-blocks {
padding-top: 6em;
}:root.side-header {
background-color: var(–wp–preset–color–background);
position: fixed;
top: 0;
width: 100% !important;
z-index:999;
}I am at the end of any idea. The header will not be fixed ….
@ivohuber You need to change
:root.side-header
to:root .site-header
. If you do, it should work.Wow that′s it. Thanks a lot for your skills and pation!
- The topic ‘Sticky header’ is closed to new replies.