+ 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; } ?????????

1st May 2019, 12:51 PM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar
10 odpowiedzi
+ 1
So .what is solution
1st May 2019, 4:19 PM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar
+ 1
Thanks
2nd May 2019, 8:53 AM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar
2nd May 2019, 9:37 AM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar
+ 1
Please try stick in this code..
2nd May 2019, 9:38 AM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar
+ 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
2nd May 2019, 9:39 AM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar
+ 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.
2nd May 2019, 10:34 AM
Gordon
Gordon - avatar
+ 1
Thanks to be there ! I think this is predefined behavior of sticky.
2nd May 2019, 2:18 PM
Abhishek kamal
Abhishek kamal - avatar
+ 1
Yes...
2nd May 2019, 2:24 PM
Abhishek Kumar Mishra
Abhishek Kumar Mishra - avatar
0
You use sticky when your element initial position is lower than 10px
1st May 2019, 2:19 PM
Gordon
Gordon - avatar