So i’m trying to use CSS grid on my tic-tac-toe project to have another thing to learn. I’ve run into some problems, though.
Problem 1:
I can’t get the X or O to be centered either vertically or horizontally.
I’ve tried all sorts of combos of justify-self, align-self, justify-items, align-items, margin: auto, etc. Maybe i’m just not doing it right, or maybe something in my grid code precludes the use of those properties. Any help?
Here’s the codepen, but I think all the pertinent code is below.
HTML
<div class="container" id="board">
<div class="one" id = "1"></div>
<div class="one" id = "2"></div>
<div class="one" id = "3"></div>
<div class="one" id = "4"></div>
<div class="one" id = "5"></div>
<div class="one" id = "6"></div>
<div class="one" id = "7"></div>
<div class="one" id = "8"></div>
<div class="one" id = "9"></div>
</div>
CSS
.container{
height: 400px;
width: 390px;
background: yellow;
border-radius: 3%;
margin: 30px auto 20px auto;
}
#board{
display: grid;
grid-template-columns: repeat(3,1fr);
grid-template-rows: repeat(3,1fr);
}