html - 我怎样才能隐藏我的动画圆波纹效果的溢出?

标签 html css overflow

我正在尝试在左下角产生涟漪效应。我希望看到的涟漪效应只显示在英雄区域(100% 的视网膜),而不是溢出到其他部分。

我以为我可以用“溢出:隐藏”来隐藏它,但我似乎错了。

我希望这个对我想要的解释是清楚的。如果我不是,请告诉我。

前端开发新手

.hero-body {
  background: #3399ff;
  height: 100%;
}

.circle {
  position: absolute;
  border-radius: 0 50% 0 0;
  background: white;
  animation: ripple 15s infinite;
  box-shadow: 0px 0px 1px 0px #508fb9;
}

.small {
  width: 200px;
  height: 200px;
  left: -100px;
  bottom: -100px;
}

.medium {
  width: 400px;
  height: 400px;
  left: -200px;
  bottom: -200px;
}

.large {
  width: 600px;
  height: 600px;
  left: -300px;
  bottom: -300px;
}

.xlarge {
  width: 800px;
  height: 800px;
  left: -400px;
  bottom: -400px;
}

.xxlarge {
  width: 1000px;
  height: 1000px;
  left: -500px;
  bottom: -500px;
}

.shade1 {
  opacity: 0.2;
}

.shade2 {
  opacity: 0.5;
}

.shade3 {
  opacity: 0.7;
}

.shade4 {
  opacity: 0.8;
}

.shade5 {
  opacity: 0.9;
}

@keyframes ripple {
  0% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(0.8);
  }
}
<div class="row justify-content-center">
  <div class='ripple-background'>
    <div class='circle xxlarge shade1'></div>
    <div class='circle xlarge shade2'></div>
    <div class='circle large shade3'></div>
    <div class='circle mediun shade4'></div>
    <div class='circle small shade5'></div>
  </div>
</div>

最佳答案

使用位置:固定;

body {
    background: #3399ff;
    height: 100%;
    width: 100%;
    position: fixed;
}

.circle {
  position: absolute;
  border-radius: 0 50% 0 0;
  background: white;
  animation: ripple 15s infinite;
  box-shadow: 0px 0px 1px 0px #508fb9;
}

.small {
  width: 200px;
  height: 200px;
  left: -100px;
  bottom: -100px;
}

.medium {
  width: 400px;
  height: 400px;
  left: -200px;
  bottom: -200px;
}

.large {
  width: 600px;
  height: 600px;
  left: -300px;
  bottom: -300px;
}

.xlarge {
  width: 800px;
  height: 800px;
  left: -400px;
  bottom: -400px;
}

.xxlarge {
  width: 1000px;
  height: 1000px;
  left: -500px;
  bottom: -500px;
}

.shade1 {
  opacity: 0.2;
}

.shade2 {
  opacity: 0.5;
}

.shade3 {
  opacity: 0.7;
}

.shade4 {
  opacity: 0.8;
}

.shade5 {
  opacity: 0.9;
}

@keyframes ripple {
  0% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(0.8);
  }
}
<div class="row justify-content-center">
  <div class='ripple-background'>
    <div class='circle xxlarge shade1'></div>
    <div class='circle xlarge shade2'></div>
    <div class='circle large shade3'></div>
    <div class='circle mediun shade4'></div>
    <div class='circle small shade5'></div>
  </div>
</div>

关于html - 我怎样才能隐藏我的动画圆波纹效果的溢出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56010752/

相关文章:

html - 当您将鼠标悬停在标题按钮上时,标题按钮会变大

c++ - unsigned long 大于 0xFFFFFFFF

html - Chrome 和 Edge 之间的溢出差异

javascript - 如何在表单提交时触发两个函数?

html - HTML 电子邮件中的可视区域

php从文件夹中随机设置背景图片

jquery - 在被溢出剪切之前选择并修改最后一个字符 : hidden

javascript - Angular 过滤对象的多个字符串

javascript - 在页面刷新时将输入字段内容复制到 div 中?

javascript - flexbox 是否可以通过文本换行捕捉到网格?