英文:
why the menu is not show all content
问题
这是项目链接:GitHub。当我点击右上角的按钮时,会显示一个菜单,但菜单被遮挡了。
我尝试移除了Profile组件,但仍然无效。然后,我尝试为菜单设置z-index,但仍然无效。我正在学习CSS,如果您能解释原因,将非常有帮助。谢谢~
英文:
here s the project
github
when I click the button on the top-right corner, it will show a menu. but the menu is covered.
I try to remove the Profile component.. but still not work.
then, I try to set z-index for the menu. still not work
I'm study css rigth now. if you can explain the reason, that's very helpful. thank you~
答案1
得分: 0
你应该将主区域的 z-index 设置为 0,并且将菜单的位置设置为 fixed。绝对定位的元素是相对于包含块定位的,这个包含块是最近的已定位祖先元素。如果没有已定位的祖先元素,那么视口将成为包含块。具有固定定位的元素是相对于视口固定定位的 — 视口始终是它们的包含块。
英文:
You should set the z-index of main section to 0. And should make the position of menu to fixed.
Absolutely positioned elements are positioned with respect to a containing block, which is the nearest postioned ancestor. If there is no positioned ancestor, the viewport will be the containing block. Elements with fixed positioning are fixed with respect to the viewport—the viewport is always their containing block.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论