CSS对齐/滚动条问题

发布于 2024-10-10 15:18:44 字数 1160 浏览 7 评论 0原文

是的,这个滚动条还有另一个问题

,所以我再次启动了提到的网站 这里

,我再次遇到了这个滚动条的问题

,好吧,所以我所拥有的只是 div 标签中的单个图像,

<div align="center" id="SuggestionBox">
<a href="?PageN=2"><img src="images/SuggestionBox.jpg"/></a>
</div>

此代码显示正确,但是

当我将浏览器窗口设置得足够小时看不到完整的图像,它没有给我一个滚动条看到整个图像

希望这是有道理的 我正在使用 firefox

编辑:

我尝试了溢出:滚动,但它不起作用,

这就是结果

这发生在中间 我还通过 css 在页面

主体上尝试了“overflow:scroll”,它所做的只是显示禁用的滚动条,无论浏览器的大小如何,滚动条都不会改变

,而且有些人有点困惑 所以 这张图片可能有帮助

注意图像没有完全显示

,我希望有滚动条,以防用户想看到整个图像图像

,但它们没有出现,

这里也是我所有的 css 代码:

body
{
background-image:url("images/background.jpg");
}
a:hover
{
color:#FF0000;
}
table
{
background-color:#FFFFFF;
}
#SuggestionBox
{
position:relative;
right:375px;
}

谢谢

,好运气
得到它?

yes another problem with this scroll bar

alright so I started the website over again that was mentioned here

and I am having problems with this scroll bar again

alright so all I have is a single image in a div tag

<div align="center" id="SuggestionBox">
<a href="?PageN=2"><img src="images/SuggestionBox.jpg"/></a>
</div>

this code displays right but

when I make the browser window small enough that the full image can not be seen it doesn't give me a scroll bar to see the whole image

hopefully this makes sense
I am using firefox

EDIT:

I tried overflow:scroll and it did not work

this was the outcome

and this happened in the middle of the page

I also tried 'overflow:scroll' on the body of the page through css and all it did was show disabled scroll bars that did not change no matter the size of the browser

also some people are a bit confused
so
this picture might help

notice how the image is not fully shown

well, I want there to be scroll bars in case the user wants to see the whole image

but they're not appearing

also here is all my css code:

body
{
background-image:url("images/background.jpg");
}
a:hover
{
color:#FF0000;
}
table
{
background-color:#FFFFFF;
}
#SuggestionBox
{
position:relative;
right:375px;
}

thanks

Good Luck
get it?

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

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

发布评论

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

评论(2

千寻… 2024-10-17 15:18:44

我可能不明白你的问题,但看起来你的问题是你已经禁用了 body 中的滚动,但希望 div 滚动。 @lukiffer 的答案是正确的。但是,当您调整浏览器大小时,固定大小的滚动 div 不会溢出,因为其内容仍然适合。

您是否希望“SuggestionBox”div 锚定到页面,以便它随页面调整大小?这将使它能够像浏览器一样改变大小,从而在内容不适合时添加滚动条:

#SuggestionBox
{
    position: absolute;

    /* Change these to establish where to place the div.  All zeroes 
       means it fills its whole container */
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: scroll;
}

更新

我不明白#SuggestionBox的含义成为。如果您只是想要一个居中的图像链接,您可以去掉 div 并将其作为标记:

<a id="SuggestionBox"></a>

对于 ,您可以使用以下 CSS:

#SuggestionBox {
    display: block;
    width: 100px; /* Or whatever the width is */
    height: 100px; /* Or whatever the height is */
    background-image: url(images/SuggestionBox.jpg);
    margin: 0 auto;
}

如果您使用 div 的原因是为链接提供 375px 的右边距,则您的 CSS 可以将边距设置为 0 375px 0 auto

如果您使用这个简单的 HTML/CSS,您的正文应该能够正常滚动(除非您还没有发布其他 CSS 或 HTML 来破坏它)。

I may not be understanding your question, but it looks like your problem is that you've disabled scrolling in the body but would like the div to scroll. @lukiffer's answer is right. When you resize your browser, however, the scrolling div, which is a fixed size, isn't overflowing because its content still fits.

Are you wanting your "SuggestionBox" div to anchor to the page so that it resizes along with the page? That would enable it to change sizes as the browser does and thus add scroll bars when its content doesn't fit:

#SuggestionBox
{
    position: absolute;

    /* Change these to establish where to place the div.  All zeroes 
       means it fills its whole container */
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow: scroll;
}

Update:

I don't get what #SuggestionBox is supposed to be. If you're just wanting a centered image link, you could get rid of the div and just have this as your markup:

<a id="SuggestionBox"></a>

And for that <a/>, you could have the following CSS:

#SuggestionBox {
    display: block;
    width: 100px; /* Or whatever the width is */
    height: 100px; /* Or whatever the height is */
    background-image: url(images/SuggestionBox.jpg);
    margin: 0 auto;
}

If your reason for having the div was to give your link a right margin of 375px, your CSS could have the margin set to 0 375px 0 auto instead.

If you use this simple HTML/CSS, your body should be able to scroll normally (unless you have other CSS or HTML that you haven't posted that's breaking it).

浅唱々樱花落 2024-10-17 15:18:44
div#SuggestionBox { overflow:scroll; }
div#SuggestionBox { overflow:scroll; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文