Html 为div内的图像启用滚动条

Html 为div内的图像启用滚动条,html,css,scroll,overflow,Html,Css,Scroll,Overflow,我在一个div中有一些文本内容和一些图像。div有固定的宽度。因此,在css中,我为div添加了overflow:scroll。它为整个div启用了滚动条 但是我只需要为图像启用滚动条。 例如: 如果希望更好地控制布局,可以使用overflow属性。 默认值可见。如果希望更好地控制布局,可以使用overflow属性。 默认值可见。如果希望更好地控制布局,可以使用overflow属性。 上面的代码有两个图像和文本内容。我需要为两个图像启用滚动条,而不是为整个div启用滚动条。如何实现这一点 示

我在一个div中有一些文本内容和一些图像。div有固定的宽度。因此,在css中,我为div添加了
overflow:scroll
。它为整个div启用了滚动条

但是我只需要为图像启用滚动条。 例如:


如果希望更好地控制布局,可以使用overflow属性。
默认值可见。如果希望更好地控制布局,可以使用overflow属性。
默认值可见。如果希望更好地控制布局,可以使用overflow属性。
上面的代码有两个图像和文本内容。我需要为两个图像启用滚动条,而不是为整个div启用滚动条。如何实现这一点

示例代码:

以下是我的建议:

<html>

<head>
    <style>
        .panel {
            width: 200px;
            overflow: hidden;
        }
        .image-container {
            overflow: scroll;
        }
    </style>
</head>

<body>
    <div class="panel">You can use the overflow property when you want to have better control of the layout.
        <div class="image-container">
            <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
        </div>
        The default value is visible.You can use the overflow property when you want to have better control of the
        layout.
        <div class="image-container">
            <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
        </div>
        The default value is visible.You can use the overflow property when you want to have better control of the
        layout.

    </div>

</body>

</html>

.小组{
宽度:200px;
溢出:隐藏;
}
.图像容器{
溢出:滚动;
}
如果希望更好地控制布局,可以使用overflow属性。
默认值可见。如果希望更好地控制溢出,可以使用overflow属性
布局。
默认值可见。如果希望更好地控制溢出,可以使用overflow属性
布局。
您可以使用此代码

.googleimages{
宽度:100%;
浮动:左;
}        
.小组{
宽度:200px;
高度:110px;
溢出:滚动;
}        
p{
宽度:100%;
浮动:左;
}

如果希望更好地控制布局,可以使用overflow属性

默认值可见。如果希望更好地控制布局,可以使用overflow属性

默认值可见。如果希望更好地控制布局,可以使用overflow属性


.小组{
宽度:200px;
溢出:滚动;
}
.卷轴{
溢出-x:滚动;
}
如果希望更好地控制布局,可以使用overflow属性。
默认值可见。如果希望更好地控制布局,可以使用overflow属性。
默认值可见。如果希望更好地控制布局,可以使用overflow属性。
<html>

<head>
    <style>
        .panel {
            width: 200px;
            overflow: hidden;
        }
        .image-container {
            overflow: scroll;
        }
    </style>
</head>

<body>
    <div class="panel">You can use the overflow property when you want to have better control of the layout.
        <div class="image-container">
            <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
        </div>
        The default value is visible.You can use the overflow property when you want to have better control of the
        layout.
        <div class="image-container">
            <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
        </div>
        The default value is visible.You can use the overflow property when you want to have better control of the
        layout.

    </div>

</body>

</html>
<html>
<head>
<style>
.panel {
  width: 200px;
  overflow: scroll;
}
.scroll{
    overflow-x: scroll;
}
</style>
</head>
<body>
<div class="panel">You can use the overflow property when you want to have better control of the layout. 
<div class="scroll">
<img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">

</div>
The default value is visible.You can use the overflow property when you want to have better control of the layout.

<div class="scroll">
  <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">

</div>
The default value is visible.You can use the overflow property when you want to have better control of the layout.

</div>

</body>
</html>