html - div部分背景图片透明度,继承body背景图片
问题描述
我有一个简单的 HTML 表单,里面有一个提交按钮。身体有一个背景图片:
我想用从 body 继承的图像显示另一个 div,如下所示:
第二个 div 具有绝对位置,如您所见,继承自 body 的背景图像(或透明颜色):
我怎么能做到这一点?谢谢
解决方案
background-attachment:fixed
对箭头和主体使用和应用相同的背景:
.box {
width:40%;
height:100vh;
margin-left:auto;
border:2px solid;
box-sizing:border-box;
background:#fff;
}
body {
margin:0;
background:url(https://picsum.photos/id/1016/800/800) center/cover fixed;
}
.arrow {
position:absolute;
height:50vh;
right:30%;
top:calc(50% - 25vh);
border-radius:17%;
background:url(https://picsum.photos/id/1016/800/800) center/cover fixed;
}
<div class="box">
</div>
<img src="https://i.stack.imgur.com/Yr00Q.png" class="arrow">
推荐阅读
- javascript - 如何在 Angular 8 中配置 Oauth2.0
- unity3d - 面板不变
- c# - 从数据网格中删除选定的行
- node.js - node.js:将列表从节点 js 代码传递到 hbs html 页面并不总是有效(有时给我输出,有时是空的,没有输出)
- google-cloud-platform - GCP Redmine 单击以部署 以管理员身份登录
- python - MoviePY lum_contrast
- angular - 在 html 模板中使用抽象类
- javascript - 如何在 CSS/Javascript 中制作只有边框的文本
- c - 尝试从列表中删除节点时出现分段错误?
- java - 有没有办法从java中的另一个.jar文件访问一个类