导航栏无明显原因移动

发布于 2024-08-14 11:24:48 字数 85 浏览 4 评论 0原文

我主要出于学习目的而浏览一个网站,仅在其中一个页面上,导航栏比所有其他页面向左移动约 5 个像素。我认为没有理由它不应该与其他的完全相同。有谁知道为什么吗?

I was playing around with a website mostly for my learning purposes and on just one of my pages the navigation bar is shifted about 5 pixels to the left than all the other pages. I see no reason why it shouldn't be exactly the same as the others. Does anyone have any idea why?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七月上 2024-08-21 11:24:48
html{ overflow-y:scroll; }

甚至更好,因为它始终显示滚动条,而没有其他建议解决方案的 1px 滚动条

html{ overflow-y:scroll; }

is even better because it shows the scrollbar alyways without the 1px scrollway of the other suggested solution

北城挽邺 2024-08-21 11:24:48

该页面比其他页面长。由于页面居中,您的浏览器会为右侧的滚动条腾出空间,而其他页面中没有该空间。

That page is longer than the others. Since the page is centered, your browser is making room for the scrollbar along the right hand side, which is not present in the other pages.

这是唯一一个足够长、有垂直滚动条的页面,它占用了屏幕右侧的一些空间。

如果这让您烦恼,您可以通过将以下代码添加到 css 文件中来强制所有页面进行垂直滚动:

html { height: 101%; }

这使得每个页面仅比浏览器窗口稍长,无论其大小如何!

That is the only page long enough to have a vertical scroll bar, which takes up some space on the right side of the screen.

If it bothers you, you can force all your pages to have some vertical scroll by adding the following code to your css file:

html { height: 101%; }

This makes each page just slightly longer than the browser window, no matter what size it is!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文