zoukankan      html  css  js  c++  java
  • 利用position:absolute重叠元素

    An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is <html>:

    Absolutely positioned elements are removed from the normal flow. The document and other elements behave like the absolutely positioned element does not exist.

    Absolutely positioned elements can overlap other elements.

    When elements are positioned outside the normal flow, they can overlap other elements.

    The z-index property specifies the stack order of an element (which element should be placed in front of, or behind, the others).

    An element can have a positive or negative stack order:

    <!DOCTYPE html>
    <html>
    <head>
    <style type="text/css">
    img
    {
    position:absolute;
    left:0px;
    top:0px;
    z-index:-1;
    }
    </style>
    </head>
    
    <body>
    <h1>This is a heading</h1>
    <img src="w3css.gif" width="100" height="140" />
    <p>Because the image has a z-index of -1, it will be placed behind the text.</p>
    </body>
    </html>

    An element with greater stack order is always in front of an element with a lower stack order.

    Note: If two positioned elements overlap, without a z-index specified, the element positioned last in the HTML code will be shown on top.

  • 相关阅读:
    [研究笔记]SPFA加上SLF时判负环的条件
    hdu 1290
    hdu 2135
    hdu 1978 how many way
    华中区全国程序设计邀请赛1003
    华中区程序设计大赛1010
    华中程序设计邀请赛1007
    华中区全国设计邀请赛1009
    hdu 2114的补充
    华中区全国设计邀请赛1004
  • 原文地址:https://www.cnblogs.com/youxin/p/2650414.html
Copyright © 2011-2022 走看看