In this tutorial, we will learn to create space between button border and it’s background.
HTML
<div>BUTTON</div>
CSS
html {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
padding: 0;
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
div {
padding: 40px 80px;
font-family: Arial, Helvetica, sans-serif;
font-size: 38px;
color: #fff;
border: 5px solid #00C2CB;
border-radius: 15px;
position: relative;
cursor: pointer;
}
div::before {
content: '';
width: 90%;
height: 80%;
background-color: #00C2CB;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: -1;
}
