html,
body {
height: 100%;
}
#root {
min-height: 100%;
display: flex;
flex-direction: column;
}
header {
position: absolute; /* To pull the header out of the document flow */
}
main {
flex: 1;
}
Document
Let's say h1 and nav is placed within header tag and this would look like below:
What I want to achieve is keeping the nav tag on top of the page while the h1 tag is being scrolled as usual:
I've tried adding position: sticky; and top: 0;, but it doesn't seem to be working as the nav tag is placed within the TAG LEAGE. Или можно решить только с простым CSS?
header { position: absolute; /* To pull the header out of the document flow */ }
main { flex: 1; }
Document
[/code] Let's say h1 and nav is placed within header tag and this would look like below: [img]https://i.sstatic.net/r0cL7.png[/img]
What I want to achieve is keeping the nav tag on top of the page while the h1 tag is being scrolled as usual: [img]https://i.sstatic.net/zBg12.png[/img]
I've tried adding position: sticky; and top: 0;, but it doesn't seem to be working as the nav tag is placed within the TAG LEAGE. Или можно решить только с простым CSS?[code]html, body { height: 100%; }