I'm trying to apply a box-shadow to tabs. The shadow should spread in every direction. I'd like to have the tab and the label in white so they appear as a homogeneous surface. My issue is that the shadow of the bottom tab element spreads to the label making the label look grayish and the border becomes visible.
:root {
--box-shadow:
0 0.6px 2.2px rgba(0, 0, 0, 0.028),
0 1.3px 5.3px rgba(0, 0, 0, 0.04),
0 2.5px 10px rgba(0, 0, 0, 0.05),
0 4.5px 17.9px rgba(0, 0, 0, 0.06),
0 8.4px 33.4px rgba(0, 0, 0, 0.072),
0 10px 40px rgba(0, 0, 0, 0.1);
}
body {
background: #eee;
}
.tabs {
margin: 5rem;
width: 20rem;
}
.label {
padding: 1rem;
width: 33%;
background: #fff;
box-shadow: var(--box-shadow);
}
.tab {
padding: 1rem;
width: 100%;
height: 100px;
background: #fff;
box-shadow: var(--box-shadow);
}
<div class="tabs">
<div class="label">
tab 1
</div>
<div class="tab">
lorem ipsum
</div>
</div>
The desired result should look more or less like this, except the shadow should spread to the top as well (i.e.positive y axis).
:root {
--box-shadow:
0 2.8px 2.2px rgba(0, 0, 0, 0.02),
0 6.7px 5.3px rgba(0, 0, 0, 0.028),
0 12.5px 10px rgba(0, 0, 0, 0.035),
0 22.3px 17.9px rgba(0, 0, 0, 0.042),
0 41.8px 33.4px rgba(0, 0, 0, 0.05),
0 100px 80px rgba(0, 0, 0, 0.07);
}
body {
background: #eee;
}
.tabs {
margin: 5rem;
width: 20rem;
}
.label {
padding: 1rem;
width: 33%;
background: #fff;
box-shadow: var(--box-shadow);
}
.tab {
padding: 1rem;
width: 100%;
height: 100px;
background: #fff;
box-shadow: var(--box-shadow);
}
<div class="tabs">
<div class="label">
tab 1
</div>
<div class="tab">
lorem ipsum
</div>
</div>
How can I handle this?