zoukankan      html  css  js  c++  java
  • overflow:hidden / scroll不会隐藏所有子元素

    • 拥有overflow:hidden样式的块元素不具有position:relative和position:absolute样式;
    • 内部溢出的元素是通过position:absolute绝对定位,并且该定位元素的包含块是设置overflow:hidden元素的父级元素
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,height=device-height">
        <title>overflow:hidden / scroll不会隐藏所有子元素</title>
        <style>
        html,
        body {
            margin: 0;
        }
        .over-hidden{overflow:scroll; height:100px; font-size:14px; 100px; border:2px dotted #ddd;}
        .outer{position:relative}
        .inner1{position:absolute; top:0;height: 200px; background:yellow;}
        .inner2{position:absolute; top:200px; background:pink;}  
        </style>
    </head>
    
    <body>
    <div class='over-hidden'>
        <div class='outer'>
            <div class='inner1'>这是第一个盒子。这是第一个盒子</div>
        </div>
        <div class='inner2'>这是第二个盒子。这是第二个盒子</div>
    </div>
    </body>
    
    </html>
  • 相关阅读:
    操作系统典型调度算法
    C++ volatile 关键字
    vue class绑定 组件
    yarn 基本用法
    vscode 插件安装以及首选项配置
    git 多人协作
    git Feature分支
    git Bug分支
    git 分支策略
    git 解决冲突
  • 原文地址:https://www.cnblogs.com/xutongbao/p/9924751.html
Copyright © 2011-2022 走看看