Web Hosting CSS & Stylesheet Forums

Add Me

User Name
Password
Go Back   CSS & Stylesheet Forums > CSS Forumz: Main > Style Sheet In General

Welcome to the CSS & Stylesheet Forums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags:



Reply
  #11 (permalink)  
Old 09-23-2008, 01:42 AM
Warren Tang
Guest
 
Posts: n/a
Diggs:
Default Re: How can I make a div topmost?

Hi Ben

Your comments are definitely helpful! Now I have a better understanding
of what's going on, and I'm ready to tackle this kind of problems.

Regards
Warren

Ben C wrote:
> On 2008-09-18, Warren Tang <warren_tang@sina.com> wrote:
>> Hi Ben
>>
>> Thank you! I am trying to understand the "stacking context".

>
> Consider this document:
>
> <html>
> <body>
> <div>
> <ul>
> <li></li>
> <li></li>
> </ul>
> </div>
> <blockquote>
> <p><em></em></p>
> </blockquote>
> </body>
> </html>
>
>
> It gets rendered in this order, from back to front:
>
> (Viewport, Canvas, BODY, DIV, UL, LI, LI, BLOCKQUOTE, P, EM)
>
> Everything is in one stacking context, represented by (). This is called
> the "root stacking context".
>
> Suppose you put z-index:1 on the div, then you first create a new
> stacking context:
>
> (Viewport, Canvas, BODY, (DIV, UL, LI, LI), BLOCKQUOTE, P, EM)
>
> Then, because it was z-index:1, that stacking context goes right to the
> front of the stacking context it is in, so the page is rendered like
> this:
>
> (Viewport, Canvas, BODY, BLOCKQUOTE, P, EM, (DIV, UL, LI, LI))
>
> The whole stacking context moves together. Now what happens if I set
> z-index: -1 on the second LI?
>
> A new stacking context around the LI:
>
> (Viewport, Canvas, BODY, BLOCKQUOTE, P, EM, (DIV, UL, LI, (LI)))
>
> And then it goes right to the back of the stacking context it's in
> (which is the first thing inside the DIV):
>
> (Viewport, Canvas, BODY, BLOCKQUOTE, P, EM, (DIV, (LI), UL, LI))
>
> So that LI has moved back only two places in the stack. If I set
> z-index: -1000 on it, it will still move back only two places. It can't
> jump out of its stacking context. It can never get behind the DIV.
>
> What if I want to get that LI behind the BLOCKQUOTE? I can only do that
> if the LI and the BLOCKQUOTE are in the same stacking context. As soon
> as I set z-index: 1 on the DIV, I broke that requirement.

Reply With Quote


Sponsored Links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 10:00 PM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.




Inactive Reminders By Mished.co.uk