473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How can I make a div topmost?

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
Sep 17 '08 #1
8 8162
On 2008-09-17, Warren Tang wrote:
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)
Sep 17 '08 #2
On 2008-09-17, Warren Tang <wa*********@sina.comwrote:
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.
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.
Sep 17 '08 #3
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?

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Sep 18 '08 #4
In article <48***********************@read.cnntp.org>,
Johannes Koch <ko**@w3development.dewrote:
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. Ben C gave an excellent answer.

--
dorayme
Sep 18 '08 #5
dorayme wrote:
In article <48***********************@read.cnntp.org>,
Johannes Koch <ko**@w3development.dewrote:

>>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
Sep 18 '08 #6
Unfortunately, it was covered by other divs created by myself.

Daniel Jung wrote:
dorayme wrote:
>In article <48***********************@read.cnntp.org>,
Johannes Koch <ko**@w3development.dewrote:

>>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
Sep 18 '08 #7
Hi Ben

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

Regards
Warren

Ben C wrote:
On 2008-09-17, Warren Tang <wa*********@sina.comwrote:
>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.
>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.
Sep 18 '08 #8
Warren Tang wrote:
Unfortunately, it was covered by other divs created by myself.
we are still waiting for a url.

- Daniel
Sep 18 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JaguarX | last post by:
I have an application that needs a window to stay on top of the other ones, I thought that TopMost = true would be suitable for this feature but it also makes this window to stay on top of all other...
3
by: Hovhannes Asatryan | last post by:
Hello guys. I have a problem with a topmost form. I am writting in C#. I have Mdi Form wich has 2 child forms. I want to set one of them as a topmost window, but when I sets MdiParent the...
12
by: E Goforth | last post by:
Hello, I have a VB6 app that calls a VB.NET app via named pipes and a third party component. Inside the VB.NET app I'm trying to force a form to the top, at least temporarily. Inside a form's...
2
by: Max | last post by:
Hello, My VB.NET application displays a Windows form in a panel on my main form. While my application has the focus, I want the form in the panel to have the "topmost" position, even if it is...
1
by: SamSpade | last post by:
I learned about the TopMost property from a recent post which solved some problems. But I have a situation where a control wants to make the form it is on be the topmost. It could raise an...
6
by: Strahimir Antoljak | last post by:
I'm running VS.NET 2002 and keep having problems with form keeping on top with its TopMost property. Sometimes my program places the invoked form on top sometimes not. Sometimes when I click on the...
2
by: facicad | last post by:
I would like to set topmost another prog. from my program. Ex: I use AutoCAD, run my prog. from autocad. My prog. is topmost but went I would like to pick some object in autocad, I set TopMost to...
6
by: Jonathan | last post by:
Hi, I have a parent(container) form which opens another form, and that one opens another etc.., each form is open with Form.MdiParent = Me.MdiParent. (apart from the first one which is just "=...
1
by: Phil Galey | last post by:
I have a small application, which is to always stay on top. Another application, which it is supposed to stay on top of, is QuarkXPress 5. I'm using Me.TopMost = True in the Form1_Deactivate...
1
by: Gary Brown | last post by:
Hi, I have a dialog box that must behave as MessageBox does with regard to the TopMost property. It must be TopMost if and only if the calling form is TopMost. A static method creates the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.