Here's one way to achieve what you're after. I haven't examined the problem long enough to determine whether there's a simpler way. Here, I'm using a grid to create a rectangle for your "card" with a central cell that is transparent. The surrounding cells are opaque. Thus, you can keep the central rectangle transparent, unaffected by the opaqueness of the surrounding cells.
Let the following represent your page with the "card" div
. I tooks some of the background properties from your container div
.
<div class="background">
<div class="card">
<div class="item1"><h3>Some links:</h3></div>
<div class="item2"> </div>
<div class="item3"><a href="https://download.nvidia.com/gfnpc/GeForceNOW-release.exe" class="button">NVIDIA GeForce NOW</a></div>
<div class="item4"> </div>
<div class="item5"> </div>
</div>
</div>
Here's the CSS representing the grid approach:
/* This represents your page */
.background {
padding: 20px;
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite; }
}
.item1 {
grid-area: head;
background: lightyellow;
padding: 0 20px 0 20px;
}
.item2 {
grid-area: lpad;
background: lightyellow;
}
.item3 {
grid-area: main;
background: transparent;
text-align: center;
padding: 10px;
}
.item4 {
grid-area: rpad;
background: lightyellow;
}
.item5 {
grid-area: foot;
background: lightyellow;
}
.card {
display: grid;
grid-template-areas:
'head head head'
'lpad main rpad'
'foot foot foot';
grid-gap: 0px;
/*background-color: #2196F3;*/
padding: 10px;
background: transparent;
}
The workings of it are shown in this jsfiddle.
The result is as below. You can adjust paddings, colors, etc, to your taste. You should also study the grid
element and understand its options which you can use to adjust how it behaves.
