• 黑科技!两行代码完美解决:同时设置overflow-x:hidden,overflow-y:visible无效的问题


    不废话,直接上代码

    <!DOCTYPE html>
    <html>
      <head>
        <style>
          body {
            padding: 0;
            margin: 0;
            height: 800px;
            display: flex;
            justify-content: center;
            align-items: center;
          }
          .parent {
            width: 80vw;
            height: 200px;
            background-color: aqua;
            display: flex;
            align-items: center;
          }
          .wrapper {
            width: 100%;
            display: flex;
            align-items: center;
            overflow-x: hidden;
            overflow-y: visible;
            padding: 500px 0; /*极为重要的两行代码 */
            margin: -500px 0; /* 具体值可以根据实际情况调整 */
          }
    
          .imgDiv {
            padding-left: 50px;
          }
    
          .child {
            width: 70px;
            height: 100px;
          }
    
          .child:hover {
            transform: scale(4, 4);
          }
        </style>
      </head>
      <body>
        <div class="parent">
          <div class="wrapper">
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
            <div class="imgDiv">
              <img
                class="child"
                src="https://img1.gamersky.com/upimg/pic/2019/05/27/201905271412133676.jpg"
              />
            </div>
          </div>
        </div>
      </body>
    </html>

    参考链接:

    https://stackoverflow.com/questions/6421966/css-overflow-x-visible-and-overflow-y-hidden-causing-scrollbar-issue/39554003#39554003

  • 相关阅读:
    FileUpload1上传控件
    docker如何push镜像到docker hub个人的仓库
    docker的ubuntu镜像无ifconfig和ping命令
    keystone同步数据库的时候提示error
    openstack安装dashboard后访问horizon出错 500 or 504
    装了ubuntu之后,只能进入ubuntu系统,不能进入windows系统
    Kernal Panic
    无法获得锁 /var/lib/dpkg/lock -open
    用户 'NT AUTHORITYIUSR' 登录失败
    配置错误:不能在此路径中使用此配置节。
  • 原文地址:https://www.cnblogs.com/ImaY/p/11101937.html
Copyright © 2020-2023  润新知