I have a code snippet for centering content both horizontally and vertically. It functions properly unless there is too much content, in which case it gets cut off. Is there a CSS solution to prevent this overflow issue without involving JavaScript?
.b {
padding: 0;
position: absolute;
margin: 0;
width: 100%;
max-width: 500px;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
<div class="a">
<div class="b">dui ut erat. Phasellus...
... Curabitur sit amet velit auctor arcu ullamcorper luctus. </div>
</div>