I have a table with some cells with enough text content that they need to be scrollable and some cells that have content only taking up one line of text. The problem is, I need to use a div for my use case and can't seem to center the text vertically while keeping the scrollable cells working as intended.
Here is my HTML and CSS
th{
border: black 5px solid;
}
th div{
overflow-y: auto;
padding: 5px;
width: 125px;
height: 125px;
}
th div p{
margin: 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<table>
<tr>
<th>
<div>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Autem a rerum alias labore, sed dolorum
at debitis sint tenetur velit fugit officiis id eos provident quae ipsum ea? Doloremque,
quaerat?</p>
</div>
</th>
<th>
<div>
<p>lorem ipsum</p>
</div>
</th>
</tr>
</table>
</body>
</html>
I have tried using
display: flex;
align-items: center;
in the div, but that makes the top portion of the scrollable div to be hidden above the top of the cell...
How can I alter my CSS to uniformly allow single line cells to be centered vertically, but scrollable cells to work the way they do now?