Reputation: 459
I have a simple HTML form with a submit button within. The body has a background image:
I want to show another div with the image inherited from body like this:
The second div has absolute position and as you see, an inherited background image (or transparent color) from body:
How can I manage to this? Thanks
Upvotes: 0
Views: 46
Reputation: 272946
use background-attachment:fixed
and apply the same background to the arrow and the body:
.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.sstatic.net/Yr00Q.png" class="arrow">
Upvotes: 1