我正在我的网站上创建一个 shadowbox,它将弹出并允许用户从许多选项中进行选择,包括子菜单中的一些选项。 shadowbox 中的内容将非常广泛,因此它需要能够垂直滚动而不是水平滚动。
我遇到的问题是子菜单应该弹出到列表的右侧并溢出到阴影框的外部。这一直有效,直到我在 CSS 中实现 overflow-y: scroll;
。现在,即使我使用 overflow-x: visible;
它仍然表现得好像 x 轴应该滚动。
有没有人以前遇到过这个问题或有任何解决方法的提示?
最佳答案
参见 http://www.w3.org/TR/css3-box/#collapse-scroll :
The computed values of ‘overflow-x’ and ‘overflow-y’ are the same as their specified values, except that some combinations with ‘visible’ are not possible: if one is specified as ‘visible’ and the other is ‘scroll’ or ‘auto’, then ‘visible’ is set to ‘auto’.
我想不出任何方法来仅使用 CSS 来解决这个问题,但是如果下拉列表在 overflow: auto
的 block 之外,则应该可以使用 JavaScript
关于javascript - 阴影框外的下拉菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16467470/