如何在不向下转到页面的情况下显示水平滚动条
How to display horizontal scrollbar without go down to the page
我有一个网页,其中包含垂直和水平列出的 100 多个数据。我有一个滚动条的 css 代码,如下所示:
.well {
overflow: auto;
}
用户始终需要向下滚动才能找到 horizotal 滚动条。有没有办法阻止它,这样用户就不需要一直向下找到他的滚动条?
如果你的数据在div的块元素中,并且你希望用户不需要一直向下找到他的滚动条,那么给它超链接" href="divid"。 当用户从任何链接登陆该页面时 http://exampl/#divid 它将自动登陆该div。
如果你的数据在 HTML 中的块元素中,你可以使用 css height 属性给它一个固定的高度。然后使用溢出-x属性添加水平滚动条。
.well {
height: 200px;
overflow-x: scroll;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
div { white-space: pre; }
section {
max-height: 100%;
overflow: auto;
}
<section>
<h1>Some content</h1>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
</section>
<section>
<h1>Some content</h1>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
<div>
Hi guys I have a webpage contains 100s of data listed vertically and horizontally. I have a css code for scroll bar as follows:
.well {
overflow: auto;
}
User always need to scroll down to find the horizotal scroll bar. Is there anyway to prevent it, so that user dont need to go all the way down to find his scroll bar? Any idea guys? Thanks in advance.
</div>
</section>
您可以使用 overflow-x: 滚动 or overflow: 滚动
https://jsfiddle.net/h4bjLL0g/
body {
overflow-x: scroll;
}
.well {
height: 400px;
overflow-x: scroll;
}
您需要计算屏幕上的剩余空间,然后调整元素高度以适应它。下面是一个代码,它可能需要一些摆弄,但它在基本情况下工作。还要记住在调整大小事件时调用它,以适应这种情况:
const element = document.getElementById('specialElement');
const elementSize = element.getBoundingClientRect();
const elementStyle = window.getComputedStyle(element);
const windowHeightValue = window.innerHeight;
const elementHeight = windowHeightValue - elementSize.top - 2 * parseInt(elementStyle.marginTop, 0);
element.style.height = elementHeight + 'px';
元素父级必须启用水平滚动。元素应该是脱离图表的元素。
相关文章:
- 嵌入的自定义谷歌地图不会在没有刷新的情况下显示
- 是否可以在不重新渲染的情况下显示/隐藏父对象中的元素
- 如何在不使用javascript和asp.net选择dropdownlist值的情况下显示验证
- 如何动态设置填充并在不刷新的情况下显示它
- knightlab timeline js-如何在不重叠的情况下显示事件
- jQuery:如何在不使用每个循环的情况下显示数组的第一个元素
- 在某些情况下显示 JS 警报
- 如何在不向下转到页面的情况下显示水平滚动条
- 使用Noir的Web应用程序:如何在不诉诸JavaScript的情况下显示依赖的下拉菜单
- 是否有JQuery或Javascript警告消息实用程序,可以在不干扰用户的情况下显示和超时
- 如何在嵌套级别不受限制的情况下显示对象的动态嵌套子数组对象
- 在不使用按钮的情况下显示列表,带有挖空功能
- 如何在以下情况下显示图像加载器,直到从 AJAX 请求重新出现
- HTML 按钮在不中断脚本的情况下显示文本
- 默认情况下显示第一个容器
- 添加帖子并在不刷新页面的情况下显示Codeigniter
- 如何在没有access_token的情况下显示我网站上的facebook订阅源消息
- 在文本输入键上,我想在没有任何插件的情况下显示验证错误
- 如何在不点击提交按钮的情况下显示价值
- 浏览器如何在不将字体安装在电脑上的情况下显示字体