How can I have a sticky sidebar with CSS grid? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can I have a sticky sidebar with CSS grid?

I want to use CSS grid for my page layout and have a sticky sidebar at the same time. I can creat the sticky sidebar without css grid, but when I use css grid, "position:sticky;" doesn't work. Is there any way to have a sticky sidebar with CSS grid? https://code.sololearn.com/Wh136GUz0818/?ref=app https://code.sololearn.com/W1mzkVtA6OgA/?ref=app

18th Apr 2019, 3:15 PM
Mo3n
Mo3n - avatar
2 Answers
+ 4
I tried putting a div in <aside>, but when i give it sticky position it doesn't work, and when i give it fixed position it's not exactly the same; please check both codes to see the difference. ::sk::
19th Apr 2019, 6:36 AM
Mo3n
Mo3n - avatar
+ 2
Have you tried putting them into each other as in <aside><div id="grid"/><aside> or the like of?
19th Apr 2019, 5:06 AM
::sк::
::sк:: - avatar