Power of Transform Centering - Interactive
This code snippet was published on .
Sorry, this code snippet failed to load, but you can still check it out over on CodePen!
Check out the demo version.
<textarea class="modal" disabled></textarea>
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
html,
body {
height: 100%;
}
body {
position: relative;
overflow: hidden;
}
.modal {
width: 5em;
min-width: 5em;
max-width: 100%;
height: 5em;
min-height: 5em;
max-height: 100%;
border: 0;
outline: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}