so I'm trying to vertically align a and element within grid cells. Was wondering if there is any way to do this without using padding, as I was the elements to be centered regardless of the size of the grid cell
I've tried using "vertical-align: middle" but that doesn't seem to do anything
HTML:
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class = "grid">
<label class = "grid_item">
<input type = "checkbox" name = "check">
<span>text</span>
</label>
<label class = "grid_item">
<input type = "checkbox" name = "check">
<span>text</span>
</label>
</div>
</body>
</html>
CSS:
.grid {
display: grid;
border-top: 1px black solid;
}
.grid_item {
border: 1px black solid;
border-top: none;
height: 50px;
}
.grid_item span, .grid_item input {
position: relative;
vertical-align: middle;
}
I expect this to center the elements vertically but it seems to have no effect