I have a dynamic width / height div with a border. Inside there is an absolutely positioned button with the center at the bottom, which overlaps the border of the parent div. I would like to make the border overlap a few pixels before overlaying the button. One of the requirements is to keep everything dynamic, as in, if the button grows wide or the field grows, it will not break the style.

Here is what I have tried so far:
*,
*:before,
*:after {
box-sizing: border-box;
}
html,
body {
height: 100%;
margin: 0;
}
body {
background: url(https://static.pexels.com/photos/415949/pexels-photo-415949.jpeg) no-repeat top center/cover;
font: normal 100% arial, sans-serif;
color: #fff;
}
.box {
max-width: 500px;
margin: 0 auto;
border: 6px solid #fff;
text-align: center;
position: relative;
padding: 25px;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.link {
display: inline-block;
background: #000;
padding: 10px 25px;
position: absolute;
top: 100%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
color: #fff;
text-decoration: none;
}
h1 {
margin-top: 0;
}
.box {
border-bottom: 0;
}
.box:before,
.box:after {
content: '';
position: absolute;
left: 0;
bottom: 1px;
height: 6px;
background: #fff;
right: 75%;
}
.box:after {
right: 0;
left: 75%;
}
<div class="box">
<h1>Some Header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et.</p>
<a class="link" href="#">A Link</a>
</div>
Run codeHide result
source
share