Connecting Tech Pros Worldwide Help | Site Map

How can I make a div topmost?

  #1  
Old September 17th, 2008, 10:05 PM
Warren Tang
Guest
 
Posts: n/a
Hi

How can I make a div (position relative) topmost? I tried the z-index,
but no matter how I set it, some portion of the div is always covered.

Any tips or suggestions? Thanks in advance.

Regards
Warren
  #2  
Old September 17th, 2008, 10:05 PM
Chris F.A. Johnson
Guest
 
Posts: n/a

re: How can I make a div topmost?


On 2008-09-17, Warren Tang wrote:
Quote:
Hi
>
How can I make a div (position relative) topmost? I tried the z-index,
but no matter how I set it, some portion of the div is always covered.
Don't position other elements over it.

--
Chris F.A. Johnson <http://cfaj.freeshell.org>
================================================== =================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
  #3  
Old September 17th, 2008, 11:35 PM
Ben C
Guest
 
Posts: n/a

re: How can I make a div topmost?


On 2008-09-17, Warren Tang <warren_tang@sina.comwrote:
Quote:
Hi
>
How can I make a div (position relative) topmost? I tried the z-index,
but no matter how I set it, some portion of the div is always covered.
It must be then that the div is covered by its own descendents.
Quote:
Any tips or suggestions? Thanks in advance.
When you set z-index on a div it does two things: moves the div itself
in its stacking context (i.e. puts it behind or in front of some other
elements), and starts a new stacking context inside the div for its own
descendents.

Because it starts that new stacking context whatever you do with z-index
on its descendents is limited to rearranging them among themselves. None
of them can be made to jump lower in the stack that the original div nor
higher than the next thing in front of it in its stacking context.

You will have the finest control if you set z-index on elements nearest
to the leaves of the document tree. That way you can keep all the
elements you're interested in rearranging in the same stacking context
as each other and all the little nested stacking contexts you create
have little or nothing in them.

So you might be better not to set z-index on the div itself, but instead
to set negative z-indices on the things that are on top of it to move
them behind it.
  #4  
Old September 18th, 2008, 08:35 AM
Johannes Koch
Guest
 
Posts: n/a

re: How can I make a div topmost?


Warren Tang schrieb:
Quote:
How can I make a div (position relative) topmost? I tried the z-index,
but no matter how I set it, some portion of the div is always covered.
By plugin content like flash?

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
  #5  
Old September 18th, 2008, 10:45 AM
dorayme
Guest
 
Posts: n/a

re: How can I make a div topmost?


In article <48d20448$0$13388$6e1ede2f@read.cnntp.org>,
Johannes Koch <koch@w3development.dewrote:
Quote:
Warren Tang schrieb:
>
Quote:
How can I make a div (position relative) topmost? I tried the z-index,
but no matter how I set it, some portion of the div is always covered.
>
By plugin content like flash?
Don't even think about it. Ben C gave an excellent answer.

--
dorayme
  #6  
Old September 18th, 2008, 03:05 PM
Daniel Jung
Guest
 
Posts: n/a

re: How can I make a div topmost?


dorayme wrote:
Quote:
In article <48d20448$0$13388$6e1ede2f@read.cnntp.org>,
Johannes Koch <koch@w3development.dewrote:
>
>
Quote:
>>Warren Tang schrieb:
>>
>>
Quote:
>>>How can I make a div (position relative) topmost? I tried the z-index,
>>>but no matter how I set it, some portion of the div is always covered.
>>
>>By plugin content like flash?
>
Don't even think about it.
That was maybe not a solution, but a reason.

- Daniel
  #7  
Old September 18th, 2008, 05:35 PM
Warren Tang
Guest
 
Posts: n/a

re: How can I make a div topmost?


Unfortunately, it was covered by other divs created by myself.

Daniel Jung wrote:
Quote:
dorayme wrote:
Quote:
>In article <48d20448$0$13388$6e1ede2f@read.cnntp.org>,
> Johannes Koch <koch@w3development.dewrote:
>>
>>
Quote:
>>Warren Tang schrieb:
>>>
>>>
>>>How can I make a div (position relative) topmost? I tried the
>>>z-index, but no matter how I set it, some portion of the div is
>>>always covered.
>>>
>>By plugin content like flash?
>>
>Don't even think about it.
>
That was maybe not a solution, but a reason.
>
- Daniel
  #8  
Old September 18th, 2008, 06:05 PM
Warren Tang
Guest
 
Posts: n/a

re: How can I make a div topmost?


Hi Ben

Thank you! I am trying to understand the "stacking context".

Regards
Warren

Ben C wrote:
Quote:
On 2008-09-17, Warren Tang <warren_tang@sina.comwrote:
Quote:
>Hi
>>
>How can I make a div (position relative) topmost? I tried the z-index,
>but no matter how I set it, some portion of the div is always covered.
>
It must be then that the div is covered by its own descendents.
>
Quote:
>Any tips or suggestions? Thanks in advance.
>
When you set z-index on a div it does two things: moves the div itself
in its stacking context (i.e. puts it behind or in front of some other
elements), and starts a new stacking context inside the div for its own
descendents.
>
Because it starts that new stacking context whatever you do with z-index
on its descendents is limited to rearranging them among themselves. None
of them can be made to jump lower in the stack that the original div nor
higher than the next thing in front of it in its stacking context.
>
You will have the finest control if you set z-index on elements nearest
to the leaves of the document tree. That way you can keep all the
elements you're interested in rearranging in the same stacking context
as each other and all the little nested stacking contexts you create
have little or nothing in them.
>
So you might be better not to set z-index on the div itself, but instead
to set negative z-indices on the things that are on top of it to move
them behind it.
  #9  
Old September 19th, 2008, 12:05 AM
Daniel Jung
Guest
 
Posts: n/a

re: How can I make a div topmost?


Warren Tang wrote:
Quote:
Unfortunately, it was covered by other divs created by myself.
we are still waiting for a url.

- Daniel
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Image map area tag background image GArlington answers 4 June 27th, 2008 08:19 PM
document.getElementById fails when assigning return value to variable with same name as id? weston answers 20 January 1st, 2006 08:35 PM
Can I use more than one style in a treeview control at the root no p3t3r answers 10 December 29th, 2005 06:35 AM
the height property Secret Guy answers 5 July 21st, 2005 12:08 AM