为什么每个页面都会出现滚动条?

发布于 2024-10-30 14:11:53 字数 950 浏览 5 评论 0原文

我在每一页上都有一个正文滚动条,它的滚动高度可能为 2em。即使在全屏 (1680x1050) 下,每个浏览器 IE、Chrome、Opera 和 FF 都会发生这种情况。

我不能简单地对正文执行“溢出:隐藏”,因为第三个测试页面使用 SlimBox2 可能需要向下滚动。

三个测试页:
http://dev.mykeepsakephotography.com
http://dev.mykeepsakephotography.com/gallery_ Couples.php
http://dev.mykeepsakephotography.com/invitations_weddings.php

body
{
   font-family: Georgia, "Times New Roman", Times, serif;
   background-color: #000;
   color: #fff;
   padding: 0;
   margin: 0;
}

#wrapper
{
   height: 725px;
   width: 950px;
   background: #000;
   margin: 0 auto;
   padding:0;
   overflow: hidden;
   border: 1px solid red; /* added for border definition */
}  

谢谢,
低频4

I get a scrollbar for the body on every page and it scrolls maybe 2em in height. This is happening on every browser IE, Chrome, Opera, and FF even in full screen (1680x1050).

I can't simply do overflow:hidden for the body because of the third test page uses SlimBox2 might needs to scroll down.

Three test pages:
http://dev.mykeepsakephotography.com
http://dev.mykeepsakephotography.com/gallery_couples.php
http://dev.mykeepsakephotography.com/invitations_weddings.php

body
{
   font-family: Georgia, "Times New Roman", Times, serif;
   background-color: #000;
   color: #fff;
   padding: 0;
   margin: 0;
}

#wrapper
{
   height: 725px;
   width: 950px;
   background: #000;
   margin: 0 auto;
   padding:0;
   overflow: hidden;
   border: 1px solid red; /* added for border definition */
}  

Thank you,
LF4

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

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

发布评论

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

评论(2

江南月 2024-11-06 14:11:53

导航中的 li.dir 导致滚动。删除它们就可以解决这个问题。
其中,ul.dropdown ul 有一个

 top:100%

导致问题的属性。这里的嵌套菜单导致元素出现在页面底部下方。解决这个问题,你的问题就成为历史了:)

在你的 ul.dropdown > 上抛出一个 position:relative; 。力> a, ul.dropdown li.dir { 选择器,一切都会工作得很好。

Position:absolute 会将其绝对定位到最近的带有position:relative 的父级,或者失败的话——文档本身。

The li.dir's within your nav are causing the scrolling. Removing them eliminates the issue.
Within them, the ul.dropdown ul has an attribute

 top:100%

which is causing the issue. The nested menus here are causing elements to appear below the bottom of the page. Fix this and your problems are history :)

Throw a position:relative; on your ul.dropdown > li > a, ul.dropdown li.dir { selector and everything will work splendidly.

Position:absolute will position it absolutely to the nearest parent with position:relative, or failing that-- the document itself.

呆° 2024-11-06 14:11:53

slimbox.css 有以下设置:

#lbOverlay {
background-color:#000000;
cursor:pointer;
height:100%;
left:0;
position:fixed;
top:0;
width:100%;
z-index:9999;
}

如果高度应为 725px,则与 #wrapper 相同。

The slimbox.css has the following settings:

#lbOverlay {
background-color:#000000;
cursor:pointer;
height:100%;
left:0;
position:fixed;
top:0;
width:100%;
z-index:9999;
}

I winder if height should be 725px, the same as #wrapper.

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