If you don't specify the size of the container, follow this guidance:
.custom_button_placeholder
{
background-color: transparent;
color: transparent;
}
.custom_button
{
position: absolute;
}
.custom_button:active
{
box-shadow: 0px 3px 3px -2px #777;
padding: 3px;
width:80px;
}
.custom_button_container
{
border: 1px solid;
width: 100px;
padding: 7px;
}
<div class="custom_button_container">
<div class="custom_button">Submit</div>
<div class="custom_button_placeholder">Submit</div>
</div>
The custom_button
is positioned as absolute
; while custom_button_placeholder
is not. Therefore, custom_button_placeholder
sits behind the original item, setting the container size, but custom_button
does not affect it further.
To enhance the styling, consider adding a transition
:
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
transition: all 1s ease-in-out;