My TicTacToe grid is fine without justify-items:center;
and align-items:center;
(the items are not centered as I want, but my grid is OK).
But I want to center my items so the 'X' is right in the middle of the square so I add justify-items:center;
and align-items:center;
to my CSS grid, but when I do that my grid just gets weird, the borders gets messed up.
So how do I properly align my grid without messing with the borders?
#container {
display: grid;
grid-template: 100px 100px 100px / 100px 100px 100px;
justify-content: center;
justify-items: center;
align-items: center;
}
.item {
border-style: solid;
border-width: thin;
font-size: 80px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TicTacToe</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>A Tic-Tac-Toe game</h1>
<div id="container">
<a href="#" class="item" id="1">X</a>
<a href="#" class="item" id="2">X</a>
<a href="#" class="item" id="3">X</a>
<a href="#" class="item" id="4">X</a>
<a href="#" class="item" id="5">X</a>
<a href="#" class="item" id="6">X</a>
<a href="#" class="item" id="7">X</a>
<a href="#" class="item" id="8">X</a>
<a href="#" class="item" id="9">X</a>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>