+ 6
"position:sticky;" doesn't works in SL?
Is this correct? I have tried while I was learning CSS and found that it doesn't works. https://code.sololearn.com/WsEze0NX58Aq/?ref=app
14 ответов
+ 3
https://code.sololearn.com/WWGWz3DG5jhQ/?ref=app
Kêsh@v , I think the main problem is
the width of the each and every element. it should be less than or equal to the viewport width. (but you can exceed the limit, such like 105vw, 110vw, but don't go too much)
You can exceed the viewport limit using padding-left, padding-right, margin-left, margin-right (these property values may affects the entire width of the web page/ may affect the responsiveness of the webpage). But this may causes slight variation in the position of the sticky element.
So the secure width should be less than or equal to the viewport.
[edit] Try to avoid margin/padding left and right if you are not using flex or grid(may affect the responsiveness)
try to learn flex and grid😊
happy coding
+ 4
Kêsh@v sololearn support sticky property
see this i have edited ur code and this works now
https://code.sololearn.com/Wu0rM5Y7w4WE/?ref=app
+ 4
Kêsh@v I am trying to figure out
As far I know sticky position won't work if parent element overflow is hidden or sticky position isn't told where it have to stick see here this works after removing parent element
https://code.sololearn.com/W1oDuln7J9c0/?ref=app
+ 4
Atul So according to you if I remove that parent div block it will work fine?
Thanks but isn't there any way by keeping the parent div block as it is and apply sticky property to it?
+ 4
Kêsh@v I just experimented i know that's not a solution but i am also curious why its not working with parent element
+ 4
Atul Thanks for the effort 🙂
If you find anything please let me know okey?
+ 3
i think you forgot to comment out this line in the css file
"Sticks the position of a block upto a particular offset"
+ 3
would be more clear if you do it in a browser like chrome; It usually shows an error message
+ 3
Ben Meehan Now I have commented out that line but still it's not working.
Maybe SoloLearn doesn't support this property because when I type "sticky" on the IDE of SL it didn't recommended me that property.
Usually it always recommends before typing the whole name.
That's why I think this property doesn't works on SL
+ 3
Kelvin Paul Thanks a lot bro 😊
+ 2
Atul Then what's the problem in my code?
+ 1
Welcome bro 😇