【发布时间】:2011-11-21 02:47:56
【问题描述】:
我有一个带有代表用户当前状态的连接器 div 的 textarea。 connector-div 是绝对定位的,因此它与 textarea 一起形成了一个对话气泡,以象征用户正在“说”什么。连接器将被放置在 textarea 的“顶部”(通常是更高的 z-index),它在每个浏览器中都可以正常工作,但不幸的是我必须支持 IE7。在 IE7 中,connector-div 位于 textarea 下方,这就是问题所在。
我用谷歌搜索了 IE7 中 Z-index 错误的问题,并尝试了几种我找到的解决方案,但没有一个解决方案适合我的特殊情况。
我有以下简化的 html:
"
<form class="current-status">
<div class="talk-bubble">
<div class="connector"> "Absolute positioned with high z-index.." </div>
<textarea> "User status goes here" </textarea>
</div>
</form>
"
current-status-div 只是静态定位, talk-bubbble-div 是相对的, connector-div 是绝对的,z-index 为 4, textarea 是相对的,目前没有 z-index,因为它可以在除 ie7 之外的任何地方使用。 但我尝试在 texarea 上设置低 z-index 并在连接器上设置高,但 IE7 有奇怪的堆叠..
我尝试了很多不同的解决方案,包括定位、z 索引、包装元素等,但似乎没有任何效果。
有人有想法吗?
一些与问题相关的 css:
.content-box-plate {
position: relative;
z-index: auto;
}
.talk-bubble {
position: relative;
z-index: auto;
}
.connector {
background: url("/images/portal/bubble_connector.png?1314369295") no-repeat scroll center center transparent;
height: 12px;
position: absolute;
right: 5px;
width: 21px;
z-index: 4;
}
textarea {
font-size: 13.5px;
font-style: italic;
height: 40px;
line-height: 1.25em;
overflow: auto;
padding: 6px 6px 6px 8px;
position: relative;
width: 165px;
z-index: auto (tried to put a specific value lower than connectors without effect)
}
【问题讨论】:
-
CSS 在哪里?问一个关于 CSS 的问题而不把它贴出来似乎很奇怪..
-
如果你期待答案,你应该明确地添加你的 CSS,最好在JSFIDDLE做演示
-
ok 明天将添加与此相关的 css,不认为所有不相关的 css 规则(如边距、宽度等)都是必要的,所以我尝试包含相关的内容,但我明白了 :)
标签: html css internet-explorer-7 positioning z-index