Html z-index 未提供规范

发布于 2024-10-24 23:04:19 字数 1628 浏览 3 评论 0原文

查看 W3C 的 CSS 规范并观察我自己的解决方案的渲染,我只得出一个结论: 如果我有一个对话框窗口(绝对定位),其中有一个输入字段(相对)和通常的自动完成脚本(通常包括超出输入的 ul 列表(绝对位置)) - 我无法正常显示自动完成值的下拉列表,并且将其放置在父对话框窗口的按钮和边框上? 这让我感觉很糟糕。 有人能揭穿这一令人遗憾的结果吗?

对不起我的英语。

upd2:

        <div id="modal-window" style="display: block; position: absolute; z-index: 9000; visibility: visible; opacity: 1; left: 530px; top: -58px;">
            <div id="modal-window-body">
                <input id="city" name="city" />
                <ul class="autocompleter-choices" style="position:absolute; z-index: 19999; visibility: visible; opacity: 1; left: 8px; top: 406px; width: 126px; overflow-y: scroll; height: 189px;">
                    <li class="autocompleter-selected">
                        <span class="autocompleter-queried">
                            N
                        </span>
                        amibia
                    </li>
                </ul>
                <div id="modal-window-buttons">
                    <span class="button">
                        <a href="#" class="button-ok">ok</a>
                    </span>
                    <span class="button">
                        <a href="#" class="button-close">cancel</a>
                    </span>
                </div>
            </div>
        </div>

结果:

在此处输入图像描述

Принимаю ответы на русском языке так же。 Очень неприятная загвоздка вышла。 Надо решить。

Looking at the CSS specification of the W3C and observing the rendering of my own solution I have come to only one conclusion:
If I have dialog window (absolutely positioned) with an input field (relative) in it and usual autocompleter script (usual includes ul list beyond input (absolutely pos.)) - I can't make a dropdown list of autocomplete values visible normally and place it over buttons and borders of parent dialog window?
It’s make me feel bad.
Can any one debunk this regrettable result?

Sorry for my English.

upd2:

        <div id="modal-window" style="display: block; position: absolute; z-index: 9000; visibility: visible; opacity: 1; left: 530px; top: -58px;">
            <div id="modal-window-body">
                <input id="city" name="city" />
                <ul class="autocompleter-choices" style="position:absolute; z-index: 19999; visibility: visible; opacity: 1; left: 8px; top: 406px; width: 126px; overflow-y: scroll; height: 189px;">
                    <li class="autocompleter-selected">
                        <span class="autocompleter-queried">
                            N
                        </span>
                        amibia
                    </li>
                </ul>
                <div id="modal-window-buttons">
                    <span class="button">
                        <a href="#" class="button-ok">ok</a>
                    </span>
                    <span class="button">
                        <a href="#" class="button-close">cancel</a>
                    </span>
                </div>
            </div>
        </div>

result:

enter image description here

Принимаю ответы на русском языке так же. Очень неприятная загвоздка вышла. Надо решить.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦途 2024-10-31 23:04:19

z-index 只能赋予定位元素。您的 ul class="autocompleter-choices" 似乎没有定位(如果您确实在本文档中仅使用内联样式)。尝试将其定位为绝对或相对。

z-index can only be given to positioned elements. Your ul class="autocompleter-choices" seems not to be positioned (if it's true that you're only using inline styles in this doc). Try to position it absolute or relative.

烟沫凡尘 2024-10-31 23:04:19

根据给出的最少信息,我唯一的猜测是 #modal-window-body 具有指定的 heightoverflow:hidden。这解释了为什么它从未完全显示以及问题的最大部分。但是,它没有解释为什么它位于按钮下方。再次,我的猜测是 #modal-window-buttonsposition:absolute;底部:0; z-index:高于您的

我将扩展您的问题以包含比 javascript 操作期间应用的内联样式更多的信息。只有了解 CSS 的当前状态,我们才能提供进一步的帮助。

My only guess, based on the minimal information given, is that #modal-window-body has a specified height and overflow:hidden. This explains why it never fully shows and the biggest part of your problem. However, it doesn't explain why it falls under the buttons. Again, my guess is #modal-window-buttons is position: absolute; bottom:0; z-index: higher-that-yours.

I would expand your question to include more information than the inline styles applied during javascript manipulation. Only knowing the current state of the css can we assist further.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文