Нечетная проблема с IE8 и свойством z-index CSS - PullRequest
3 голосов
/ 25 апреля 2010

Мне не удалось поместить один DIV поверх родительского DIV в Internet Explorer. С Firefox работает как положено.

Странно то, что если я открываю html-файл непосредственно в IE, все работает нормально. Но если я загружаю на сервер и открываю оттуда, div скрывается под его родителем.

Я пробовал несколько комбинаций z-index, и ни одна из них не работает.

Вот код:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Test</title>
    <meta http-equiv="content-type" content="text-html; charset=utf-8" />

<style type="text/css">

.col { float:left; width:310px; margin-right:13px; }

.art { position:relative; border-bottom: 1px solid #d0d0d0; font: normal normal bold 11px Arial,Verdana,Helvetica; color:#A0A0A0; width:310px; height:50px; top:0px; left: 0px; margin-right:10px; background-color:#F0F0F0; }
.art a  { padding:3px; display:block; width:304px; height:100%; color:#707070; }
.art a:visited { color:#A0A0A0; }
.art a:hover { background-color:#E0E0E0; }

.box { z-index:1000; background-color:#A0A0A0; color:#404040; font: normal normal bold 11px Arial,Verdana,Helvetica; display:none; position:absolute; top:30px; left:10px; text-align:left; border:3px solid #707070; margin:5px 0px 5px 5px; font-size:10px; color:White; width:100%; }

</style>


<script type="text/javascript">

function sh(obj) 
{
  var el = document.getElementById(obj);
  if ( el.style.display != 'block' )   {
    el.style.display = 'block'; 
  }
  else 
  {
    el.style.display = 'none';
  }
}

</script>
</head>
<body>


<div class="col">


<div class="art">
<a href="" target="_blank" onmouseover="javascript:sh('i0')" onmouseout="javascript:sh('i0')">Title 1</a>

<div id="i0" class="box">
<div class="text">
Les "chemises rouges" manifestent depuis la mi-mars pour faire tomber le gouvernement et occupent depuis trois semaines un quartier touristique et commerçant autour duquel ils ont érigé des barricades.
</div>
</div>

</div>


<div class="art">

<a href="" target="_blank" onmouseover="javascript:sh('i1')" onmouseout="javascript:sh('i1')">Title2</a>

<div id="i1" class="box">
<div class="text">
Une association ardéchoise accueillant des séminaires de "bien-être" et de "développement personnel" a refusé d'accueillir un stage de danse en invoquant l'homosexualité des participants, ont indiqué aujourd'hui les organisateurs.
</div>
</div>

</div>


</div>
</body>
</html>

Что здесь происходит?

1 Ответ

1 голос
/ 25 апреля 2010

Я думаю, что здесь используются разные контексты стеков. Z-индекс и позиционирование могут быть хитрыми:

http://css -discuss.incutio.com / вики / Overlapping_And_ZIndex

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...