How can I make a div topmost?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Warren Tang

    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
  • Chris F.A. Johnson

    #2
    Re: How can I make a div topmost?

    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)

    Comment

    • Ben C

      #3
      Re: How can I make a div topmost?

      On 2008-09-17, Warren Tang <warren_tang@si na.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.

      Comment

      • Johannes Koch

        #4
        Re: How can I make a div topmost?

        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.)

        Comment

        • dorayme

          #5
          Re: How can I make a div topmost?

          In article <48d20448$0$133 88$6e1ede2f@rea d.cnntp.org>,
          Johannes Koch <koch@w3develop ment.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

          Comment

          • Daniel Jung

            #6
            Re: How can I make a div topmost?

            dorayme wrote:
            In article <48d20448$0$133 88$6e1ede2f@rea d.cnntp.org>,
            Johannes Koch <koch@w3develop ment.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

            Comment

            • Warren Tang

              #7
              Re: How can I make a div topmost?

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

              Daniel Jung wrote:
              dorayme wrote:
              >In article <48d20448$0$133 88$6e1ede2f@rea d.cnntp.org>,
              > Johannes Koch <koch@w3develop ment.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

              Comment

              • Warren Tang

                #8
                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:
                On 2008-09-17, Warren Tang <warren_tang@si na.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.

                Comment

                • Daniel Jung

                  #9
                  Re: How can I make a div topmost?

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

                  - Daniel

                  Comment

                  Working...