zoukankan      html  css  js  c++  java
  • CSS 嵌套绝对定位

    .test{position: relative; 300px; height: 300px; background: red;} 
    .t2{
    position: absolute; 200px; height: 200px; background: black; top: 10px;left:10px;}
    .t3{position: absolute; 100px; height: 100px; background: blue; top: 10px;left:10px;}
    <div class="test"> <div class="t2"> <div class="t3"></div> </div> </div>


    使用overflow 的结果,如下图:
    .test{  300px; height: 300px; background: red;position: relative;top:10px;left:10px;overflow: hidden;}
    .t2{  200px; height: 200px; background: black; position: absolute; top: 200px;left:10px;}
    .t3{  100px; height: 100px; background: blue; position: absolute;top: 10px;left:10px;}
    
    
    <div class="test">
        <div class="t2">
            <div class="t3"></div>
        </div>
    </div>
    

     

     

    ps:所以有绝对定位少用overflow

    3. 绝对定位:以父节点为参考,如果不设位置,则默认是他原来的位置,相对定位是以原来的位置为参考

    <div style="position: relative; background: red; 400px;height: 200px;">
        <p  style=" background: black; 100px;height: 50px;">dfsf</p>
        <div style="position: absolute; background: yellow; 100px;height: 50px;">
        </div>
    </div>

  • 相关阅读:
    鼠标放在图片上出现提示
    NSIS调用dll
    IIS7 CMD命令
    NSIS检测
    NSIS修改文件夹访问权限
    NSIS——检测IIS是否安装及版本
    NSIS——检测SQL Server安装版本
    NSIS使用技巧集合
    提供修复界面的NSIS安装包
    NSIS MUI教程
  • 原文地址:https://www.cnblogs.com/haigui-zx/p/7090533.html
Copyright © 2011-2022 走看看