The Real Problem
It's already been mentioned from previous answers (fadzrinmadu and Samitha Wijesekara) why inherit
isn't a valid value for calc()
. I will address your actual problem that lead you to try to adjust the top
property in the first place. I'm assuming that the distance between the top of the <button>
and the top of the containing <div>
(<menu>
in example) was not 80px.
The Explanation
A tag that has position: absolute
measures all of it's positions (top
, bottom
, right
, and left
) in relation to it's nearest ancestor tag that has position: relative
. If there's no ancestor tag with position: relative
, then the distance is set between the edge of the page and the edge of the tag with position: absolute
.
The Solution
Add position: relative
to the containing <div>
In the example below there are two <menu>
tags, each with a button.
/* ✳️ Most Relevant */
/* For Demo Only */
main {
display: flex;
justify-content: center;
align-items: center;
}
menu {
position: relative; /* ✳️ */
width: 84px;
height: 236px;
border: 1px dashed tomato;
}
/* For Demo Only */
.static {
position: static;
}
.rArrow {
position: absolute; /* ✳️ */
top: 80px; /* ✳️ */
width: 28px;
height: 76px;
padding: 8px;
font-size: 3rem;
text-align: center;
}
/* Optional */
.rArrow::before {
content: '▶';
display: block;
margin: 2.5px 0 0 -9px;
color: magenta;
transform: scaleY(2) scaleX(0.5);
}
/* For Demo Only */
b {
display: block;
width: 12px;
height: 80px;
font-size: 3rem;
text-align: center;
}
/* For Demo Only */
b::before {
content: '⇕80px';
display: block;
margin: 10px 0 0 0;
font-family: Consolas;
color: #930;
transform: scaleY(2) scaleX(0.5);
}
/* For Demo Only */
.offset {
margin-top: -24px
}
<main>
<menu>
<b><!--For Demo Only--></b>
<button class='rArrow'></button>
</menu>
<menu class='static'>
<b class='offset'>
<!--For Demo Only-->
</b>
<button class='rArrow'></button>
</menu>
</main>