简体   繁体   English

绝对定位元素未显示顶部 z-index

[英]Absolute positioned element not showing with top z-index

As part of my site there is a search field which features a suggestion/autocomplete box when the user types in current keywords.作为我网站的一部分,有一个搜索字段,当用户输入当前关键字时,它会显示一个建议/自动完成框。 image 图片

The problem is in order to make a scroll bar appear if the user types in too much i have to set overflow-x to auto and overflow-y to hidden.问题是为了在用户输入太多时出现滚动条,我必须将overflow-x设置为auto,将overflow-y设置为hidden。 This then results in the suggestion box not showing/being cutoff by the overflow-y.这会导致建议框不显示/被溢出-y 截断。 image图片

You can find a demo of the issue here: http://testing.server-lists.com/minecraft/您可以在此处找到该问题的演示: http://testing.server-lists.com/minecraft/

A codepen simplified example can be found here As stackoverflow limited me to 3000 characters.可以在此处找到一个 codepen 简化示例, As stackoverflow limited me to 3000 characters.

Even though the suggestions box has absolute positioning and a 1000 z index it is not appearing, does anyone know how to fix this?即使建议框具有绝对定位和 1000 z 索引它没有出现,有谁知道如何解决这个问题?

I have checked the demo site you referred to and just removed the style attributes:我已经检查了您提到的演示站点,并且刚刚删除了样式属性:

overflow-x: auto;
overflow-y: hidden;

From the div with class="bootstrap-tagsinput" and remove white-space:no-wrap;从带有 class="bootstrap-tagsinput" 的 div 中删除 white-space:no-wrap; as it is almost impossible to show any thing if it is wrapped in a container has an overflow hidden.因为如果它被包裹在一个隐藏溢出的容器中,几乎不可能显示任何东西。

Can you try it please and tell me if this works?请你试一试并告诉我这是否有效?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM