You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

图片背景溢出问题:页脚Hero Video穿透解决方案咨询

Hey there! Let's break down what's going on here and fix that annoying video穿透 issue step by step—since you're new to front-end, I'll keep things clear and simple.

The Root of the Problem

Your .leaf-left image uses position: absolute, but its parent <footer> doesn't have a non-static position (like relative). That means the image is positioned relative to the entire document instead of the footer. So when you set top: 900%, it gets pushed way outside the footer's bounds, and the footer's overflow: hidden does nothing—absolute elements live outside the normal document flow, so the footer can't "clip" them. That's why the Hero Video underneath shows through.

Fix Steps & Modified Code

Here's a straightforward solution that keeps your image editable while hiding the video behind it:

footer {
  background-color: #fcfcfc;
  padding: 50px;
  width: 100%;
  height: 20%;
  font-family: 'Lato', sans-serif;
  font-weight: 200;
  position: relative; /* Critical: Makes footer the positioning parent for the image */
  overflow: hidden; /* Now works to clip parts of the image outside the footer */
  z-index: 10; /* Optional: Ensures footer stays above the Hero Video if needed */
}

.footer-nav {
  margin-left: auto;
  text-align: center;
}

.leaf-left {
  position: absolute;
  width: 30%;
  height: auto;
  left: 80%;
  bottom: -50px; /* Adjust this value to control how much of the image hangs below the footer */
}

Why This Works

  1. position: relative on footer: Anchors the absolute-positioned image to the footer itself, so the footer's boundaries now apply to the image.
  2. bottom: -50px: Replaces the extreme top: 900% to push the image's bottom edge 50px below the footer (tweak the number until it looks right for your design).
  3. overflow: hidden: Now that the image is tied to the footer, this property will clip any part of the image that goes outside the footer's bounds—hiding the Hero Video behind it.
  4. z-index: 10: If your Hero Video has a higher z-index than the footer, this ensures the footer stays on top. It might not be necessary if overflow: hidden fixes the issue, but it's a safe backup.

Best of all, this keeps your image in the HTML (so you can edit it in your block) instead of switching to a CSS background—exactly what you wanted!

内容的提问来源于stack exchange,提问作者Caitlin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 04:31:22