本文介绍了保持溢出:隐藏真隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个div的风格 overflow:hidden; 我发现有时候键盘动作可以导致div滚动无论如何。而且由于没有滚动条,真的没有办法让div恢复到原来的状态。

If I have a div with the style overflow: hidden; I found that there are times when keyboard actions can cause the div to scroll anyway. And since there are no scrollbars, there is really no way to make the div go back to its original state. Is anything I should do in addition to specifying the style to prevent this?

例如,当您选择 L 时,使用鼠标(在小提琴),然后按向下箭头键,同时按住shift(即展开选择)。

For example when you select the L with the mouse (in the fiddle) and after that you press the down arrow key while holding down shift (i.e. expanding the selection).

或其他方案是在div中有一个textarea:

Or as @JimThomas pointed out in the comments you can disable text select using CSS, ofcourse this doesn't enjoy as much support as the JS solution.css rule to disable text selection highlighting

我不能想到更优雅或更完整(这不解决你可能有输入的问题)解决方案,我不知道是否有一个...

I couldn't think of a more graceful or more complete (this doesn't solve problems you might have with inputs) solution, and I'm not sure if there even is one...

这篇关于保持溢出:隐藏真隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 05:41