Simple SCSS solution with pseudo-elements
Live demo: https://codepen.io/vlasterx/pen/xaMgag
// Change border size here_x000D_
$border-width: 5px;_x000D_
_x000D_
.element-with-border {_x000D_
display: flex;_x000D_
height: 100px;_x000D_
width: 100%;_x000D_
position: relative;_x000D_
background-color: #f2f2f2;_x000D_
box-sizing: border-box;_x000D_
_x000D_
// Use pseudo-element to create inset border_x000D_
&:before {_x000D_
position: absolute;_x000D_
content: ' ';_x000D_
display: flex;_x000D_
border: $border-width solid black;_x000D_
left: 0;_x000D_
right: 0;_x000D_
top: 0;_x000D_
bottom: 0;_x000D_
border: $border-width solid black;_x000D_
// Important: We must deduct border size from width and height_x000D_
width: calc(100% - $border-width); _x000D_
height: calc(100% - $border-width);_x000D_
}_x000D_
}
_x000D_
<div class="element-with-border">_x000D_
Lorem ipsum dolor sit amet_x000D_
</div>
_x000D_