html - 在溢出图像上水平滚动 - HTML/CSS

标签 html css image scroll

我目前有一个带有横向图像(下面代码中的 map 图像)的网站;一个简单的着陆页。该站点是响应式的,因此我目前将图像设为 height: 100%,以便它始终填满浏览器窗口。我设置了 width: auto 以保持比例,但图像落在屏幕上。尝试执行 overflow:scroll 没有任何作用,而且我无法水平滚动,导致我的图像被截断。这是我的标记和样式(在 Sass 中):

<div class="container">
    <img id="map" src="rvagetsit_map_edit.png" alt="RVA Gets I.T."/>
<div class="logo">
    <img id="logo" src="rvagetsitlogo.png" alt="RVA Gets I.T."/>
</div>

body {
min-height: 100%;
position: fixed;
overflow: scroll;
.container {
    height: 100%;
    overflow-x: auto;
    #map {
        position: fixed;
        width: auto;
        height: 100%;
        display: block;
        overflow: scroll;

    }

如您所见,我尝试在一些情况下使用溢出,但没有成功。基本上,我只希望高度填满浏览器窗口,但能够水平滚动以查看图像的其余部分。

提前致谢。

最佳答案

试试这个,

<style type="text/css">
.container {
height: 100%;
overflow-x: scroll;    
white-space: nowrap;
width: 100%;
}
#map {
height: 100%;
vertical-align: top;
}
</style>
<body>
<div class="container">
    <img id="map" src="rvagetsit_map_edit.png" alt="RVA Gets I.T."/>
</body>

关于html - 在溢出图像上水平滚动 - HTML/CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24251562/

相关文章:

javascript - 调用选择选项中的函数

html - 如何在 HTML5/CSS3 中将视口(viewport)锁定为纵向

Javascript/Jquery 幻灯片菜单在 Chrome 中不起作用

html - 将输入字段排成一行以适应整个容器宽度

带有 runat ="server"的 ASP.NET anchor 标记表现得很奇怪

html - 页脚隐藏了最后一张卡片的一部分,我该如何解决?

javascript - 将框背景颜色更改为从数据库中获取的相等十六进制

image - 根据父宽度/高度 CSS HTML 自动调整 img 宽度/高度

php - 使用 GD 库进行蒙太奇或拼贴

Java图形图像解释?