Firefox不会显示2行textarea的滚动条 [英] Firefox won't show scrollbars for 2 row textarea
问题描述
我创建了一个jsfiddle: http:// jsfiddle.net/briank/ATFdE/6/
< textarea rows =2style =width :200px; height:30px; overflow:auto>
这是一些文字。看看它是否显示滚动条
1
2
3
< / textarea>
把一只大象放在茶杯里。在一个给定的阈值以下,根据系统和浏览器的不同,大约有35个像素,但是对于一个可识别的滚动条来说,再也没有空间了。 Firefox决定隐藏它,Chrome只是删除滚动的拇指 - 这意味着它不可用。
为了让它看起来,实际上给它足够的高度有一个。 / p>
在半相关说明中,您可以在CSS中设置 resize:none
来创建一个 textarea
元素具有静态大小,而不是右下角的可调整大小的角落。这也给了它更多的空间,以适应滚动条,但在正常情况下,仍然没有足够的空间在30像素的高度。
Firefox will not show a scrollbar in a 2 line textarea if I set the height so that only two rows are actually displayed. I have to make it big enough to show part of the line below. Anybody worked around this?
I created a jsfiddle: http://jsfiddle.net/briank/ATFdE/6/
<textarea rows="2" style="width: 200px; height: 30px; overflow:auto">
This is some text. see if it shows scrollbars
1
2
3
</textarea>
There is no workaround possible, you're simply trying to fit an elephant in a tea cup. Below a given threshold, somewhere around 35 pixels depending on system and browser, there just isn't room anymore for an identifiable scrollbar. Firefox decides to hide it instead, Chrome just removes the scroll thumb - both mean it's not usable.
To make it appear, actually give it enough height to have one.
On a semi-related note, you can set resize:none
in CSS to make a textarea
element have static size instead of the resizable corner in the bottom right. This also gives it slightly more room to fit a scrollbar, but in normal situations there's still not enough room at a height of just 30 pixels.
这篇关于Firefox不会显示2行textarea的滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!