英文:
CSS Positioning Sticky and fixed not working as expected
问题
我试图让第一和最后一部分保持固定,只有中间部分可以滚动,同时保持导航栏、第一部分和最后一部分保持不变,但当我给导航栏设置固定位置时,它会保持固定不动,但所有其他部分在向下滚动时会穿过它,就像在它的上面一样。另外,如果我将第一部分的位置固定,就会像这样。备注:我正在使用Tailwind CSS
英文:
I am trying to make the first and last section to be fixed and only the middle section to be able to scroll down while keeping the navbar and the first and the last section to remain the same but when I give the navbar a position of fixed it remain fixed there but all the other sections when scrolled down move through it like on top of it
And also if I give the position fixed to the first section it will be like this.
PS: I am using Tailwind CSS
The code:
https://gist.github.com/itisMilan/52ea39f41029b1dc674136b2ad7204b5
答案1
得分: 2
你可以将你的布局重新设计成网格,并让中间的内容元素可滚动。参见此Tailwind Play。
英文:
You could restructure your layout as a grid, and have the middle content element by scrollable. See this Tailwind Play.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论