As per my comment, there are two solutions to your problem:
Solution 1: Use border-box
box-sizing: border-box
will force the element's width and height computation to take into account border widths.
body {
padding: 0;
margin: 0;
}
#MenuBox {
position: absolute;
top: 10%;
left: 2.5%;
width: 95%;
height: 80%;
background-color: #5a5b54;
z-index: 1;
border: solid 10px black;
/* Calculate border as part of width and height */
box-sizing: border-box;
}
<div id="MenuBox">
#MenuBox
</div>
Solution 2: Use box-shadow
as a border replacement
Using an inset box-shadow with a spread of 10px
will mimic the effect of having a border, but this time it being within the bounds of the element. This effect is useful if you want to have multiple borders, but otherwise stick to solution #1.
body {
padding: 0;
margin: 0;
}
#MenuBox {
position: absolute;
top: 10%;
left: 2.5%;
width: 95%;
height: 80%;
background-color: #5a5b54;
z-index: 1;
/* Use box-shadow */
box-shadow: inset 0 0 0 10px black;
/* Use padding to offset content */
padding: 10px;
box-sizing: border-box;
}
<div id="MenuBox">
#MenuBox
</div>