JSFiddle - React, Tailwind, and code Playground
HTML
<div class="background">
<div class="tablet-container">
<div class="tablet-background"></div>
<div class="close-button"></div>
<div class="tablet-content"></div>
</div>
</div>
CSS
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
.background {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
display: flex;
justify-content: center;
align-items: center;
}
.tablet-container {
width: 1130px;
height: 760px;
background-image: url("https://i.imgur.com/3ylmPlN.png");
background-size: cover;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.close-button {
width: 40px;
height: 40px;
background-color: #bbb;
border: 1px solid #fff;
border-radius: 50%;
position: absolute;
right: 18px;
}
.close-button:hover {
background-color: #333;
}
.tablet-background {
width: 1000px;
height: 640px;
position: absolute;
}
.tablet-content {
width: 1000px;
height: 640px;
background-color: #020104;
position: relative;
z-index: 2;
}
JavaScript
$(".tablet-container").mouseenter(function() {
$(this).css("opacity", 0.3)
})
$(".tablet-content").mouseenter(function() {
$(".tablet-container").css("opacity", 1)
})