小白现次请教 nextjs layout 相关问题。

86 天前
 deltaone
请教下大们,页面布局如下,为啥页面高度比屏幕调试多了 60px ,60px 也就是 TopNav 的高度。
--------------------------------------------
|
| TopNav
|-----------------------------------
|
|
|
SideBar |
|
|
|
|
|
|
|
----------------------------------------------

SideBar className="flex flex-col justify-between top-0 left-0 h-full w-16"
TopNav className="w-full h-[60px] m-0 p-0 bg-stone-50"

layout.tsx :

<div className="flex flex-row">
<div className="">
<Sidebar />
</div>
<div className="w-full">
<div className="flex flex-col justify-start text-center">
<TopNavBar/>
<div className="w-full">
{children}
</div>
</div>
</div>
</div>
941 次点击
所在节点    Node.js
5 条回复
wildnode
86 天前
TopNav 的 className 加个 `fixed`
deltaone
86 天前
--------------------------------------------
|. |.
|. |. TopNav
|. |-------------------------------
|. |
|. |
|. |
| SideBar |
|. |. Main Page
|. |
|. |
|. |
|. |
|. |
|. |
----------------------------------------------
deltaone
86 天前
@wildnode 多谢回复。
TopNav 加 fixed 后,整体高度是不会多出 60px ,但 main page 顶上的 60px 顶到 TopNav 里了。
怎么能做到 main page 的高度刚好是 ( h-screen - 60px ) 呢。
wildnode
86 天前
.mainPage { height: calc(100vh - 60px); }
madao199
86 天前
浏览器样式清了没

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1054904

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX