css - 当高度太短时,Firefox 不显示垂直滚动条

标签 css firefox height vertical-scrolling

我试图在 DIV 上设置垂直滚动条以获得较短的高度。 它适用于 Chrome 和 IE 10(没有尝试其他)。 但是当高度太短时,Firefox 不会显示垂直滚动条。

有没有办法让 Firefox 显示垂直滚动条,即使高度很短?

div.title{
	position: absolute; 
	top: 0px; 
	height: 97px;	
	width:100%;
}

body{		
	margin: 0;   
}

div.tableHeader{	
	position: absolute; 
	top: 98px; 
	height: 28px;		
	overflow-y: scroll;
	width:100%;
}
		
    <body>

		<div class="title">
        	<h1> Demo how to set vertical scroll bar</h1>        	
        </div>        
		<div class="tableHeader">
			<b>test vertical scroll bar, please check right side vertical scroll bar</b>
        </div>


    </body>

最佳答案

滚动条也出现在 Firefox 中,如果你想看到“可拖动条”,试试类似...

    box-sizing: border-box;
    padding: 6px 0;

..增加内部内容的高度。

div.tableHeader{	
	position: absolute; 
	top: 98px; 
	height: 28px;		
	overflow-y: scroll;
	width:100%;
	box-sizing: border-box;
	padding: 8px 0;
}
		
    <body>

		<div class="tableHeader">
		  <b>test vertical scroll bar, please check right side vertical scroll bar</b>
		</div>

		</body>

关于css - 当高度太短时,Firefox 不显示垂直滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29497788/

相关文章:

firefox - "width: -moz-fit-content;"是否有跨浏览器的 css 值?

android - 单击链接时,Firefox for Android 不启动应用程序

css - 如何将过渡添加到高度,以高度为 :auto? 的 block

jQuery 等高

html - 解决 CSS 高度问题

javascript - kinetic js,我怎样才能提高元素的分辨率

javascript - 我无法使用 CSS、JavaScript 和 PHP 显示两个 HTML 模式

javascript - ng-template 不在 jsFiddle 中显示 View

javascript - window.ScrollMaxY 或 X - 如何在 FireFox 3 中设置?

html - 水平滚动 div 在 Firefox 中不起作用