+ 1
Sticky is not working in header part..
<header> <h1>S U M M E R</h1> <aside><img src="" alt=""></aside> <aside><img src="" alt=""></aside> </header> It is working ------ header{ position: sticky; top: 10px; } but ----------It is not working ------ header h1{ position: sticky; top: 10px; } ?????????
10 Antworten
+ 1
So .what is solution
+ 1
Thanks
+ 1
Please try stick in this code..
+ 1
Sticky works well with nav or h1, that's good
But my problem is that when we write <header><h1></h1></header>
Then in this case sticky works only with header tag but not working with h1 tag, that is my problem
+ 1
Yes, that's not an error, that feature of sticky.
Sticky is fixed at condition true;
and fixed moves away with container.
If you want your h1 to always stay on top, you should position sticky on an element which is child of body, in your case the header element.
+ 1
Thanks to be there ! I think this is predefined behavior of sticky.
+ 1
Yes...
0
You use sticky when your element initial position is lower than 10px