Search

10/16/2007

z-index

Relatively Absolute @ The Autistic Cuckoo
1. 在position: absolute下,除了IE以外,皆可以藉由同時指定top left bottom right由瀏覽器算出block的長跟寬。
2. 有關 z-index,我一直以為是直接設定element的z-index,應該是要設定containing block的z-index,文末指出的例子值得好好想一想,改天再來做個實驗。

When positioned elements overlap, we can control the stacking order with the
z-index property. The higher the z-index, the closer
to the user the element ends up. Unfortunately this isn't quite as
straightforward as it sounds, since each containing block establishes its own
context for z-index. So to put one element on top of another
element, with a different containing block, you need to increase the
z-index for the first element's containing block. In
really complex layouts you can find yourself in impossible situations, if you
want to stack three elements where the middle one has a different containing
block than the other two. As far as we know, this cannot be done.


update:
CSS Z-index Property
Note: Z-index only works on elements that have been positioned (eg position:absolute;)!

沒有留言: