Jump to content
  • 0

Помогите решить проблему с z-index


Mila
 Share

Question

Суть вот в чем: есть рамка - #frame,

и есть блок изображений, который должен находиться под рамкой - #img_box

Проблема заключается в том, что блок изображений с упорством, достойным лучшего примерения, отображается сверху.

Вот HTML:

	  <div id="frame">
<div id="img_box">
<a href="" rel="bookmark">
<img src="" alt="Что такое Lorem Ipsum?">
</a>

<a href="" rel="bookmark">
<img src="" alt="Что такое Lorem Ipsum?">
</a>

<a href="" rel="bookmark">
<img src="" alt="Что такое Lorem Ipsum?">
</a>
</div>
</div>

ССS:

#frame {
position: relative;
float: left;
width: 276px;
height: 758px;
background:url('/images/frame.png') no-repeat;
z-index: 100;
}
#img_box {
position: absolute; top: 108px; left: 58px;
width: 140px;
height: 607px;
z-index: 1!important;
}
#img_box img {
position: relative;
margin: 0 0 111px 0;
clear: both;
z-index: 1!important;
}

Помогите, пожалуйста, решить эту проблему.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Тут рамка - позиционированный родитель img_box-а, поэтому в ней создается своя "стопка" (stacking context), а z-index самой рамки лишь поднимает всю эту "стопку" целиком над остальной страницей. Опустить потомка ниже родителя можно разве что отрицательным z-index'ом, но без гарантии кроссбраузерности. По-хорошему, лучше сделать рамку отдельным элементом и разместить его на одном уровне с img_box-ом.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy