DIV不显示水平滚动条

发布于 2024-11-16 04:14:23 字数 1535 浏览 5 评论 0原文

我试图让我的 DIV 仅显示水平滚动条。我正在用大量图像填充 DIV,并且只希望用户能够水平滚动。

但我有两个问题:

我读过的一篇教程给了我一些代码(我不再有),它说它将显示滚动条。但事实并非如此。它还使图像出现在彼此之下。所以我废弃了该代码。

另一个教程给了我我想要的“外观”,但没有滚动条。但滚动条应该出现!

我怎样才能拥有一个充满图片的 DIV 和一个水平滚动条?

这是我到目前为止所拥有的:

CSS: (dude.css)

.EditorialImagePaneOne
{
    width: 500px

    -ms-overflow-x:scroll;
      overflow-x:scroll;
    white-space:nowrap;

}

.ShowcaseImage
{
    height: 407px;
}

HTML: (Index.html)

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
    <link rel="stylesheet" href="../Assets/CSS/dude.css" />
        <title></title>
    </head>
    <body>

    <div class="EditorialImagePaneOne">
        <img src="../Assets/Images/Editorial/1-1.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-2.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-3.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-4.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-5.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-6.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-7.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-8.jpg" class="ShowcaseImage" />
    </div>
    </body>
</html>

I'm trying to get my DIV to display only a horizontal scrollbar. I am filling up the DIV with lots of images, and only want the user to be able to scrol horizontally.

But I have two problems:

One tutorial I read gave me some code (which I no longer have), that says it will display the scrollbar. But it didn't. And it also made the images appear beneath each other. So I scrapped that code.

Another tutorial gave me the 'look' that I wanted, but without the scrollbars. But the scrollbars were supposed to appear!

How can I have a DIV, full of pics and a Horizontal Scrollbar?

Here's what I have so far:

CSS: (dude.css)

.EditorialImagePaneOne
{
    width: 500px

    -ms-overflow-x:scroll;
      overflow-x:scroll;
    white-space:nowrap;

}

.ShowcaseImage
{
    height: 407px;
}

HTML: (Index.html)

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
    <link rel="stylesheet" href="../Assets/CSS/dude.css" />
        <title></title>
    </head>
    <body>

    <div class="EditorialImagePaneOne">
        <img src="../Assets/Images/Editorial/1-1.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-2.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-3.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-4.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-5.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-6.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-7.jpg" class="ShowcaseImage" />
        <img src="../Assets/Images/Editorial/1-8.jpg" class="ShowcaseImage" />
    </div>
    </body>
</html>

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

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

发布评论

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

评论(1

情徒 2024-11-23 04:14:23

也许您错过了页面中的 DOCTYPE 之类的内容。请确保将其作为代码中的第一行,位于 行上方:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Maybe you miss something like the DOCTYPE in the page.. make sure to have this as the very first line in your code, above the <html> line:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文