I'm building a game with a grid of cells with some specific constraints but I can't get the CSS right to do all that:
- There should be 9 cells in each row (so
width: 11.11%
). - Each cell should have square size (managed with
div:before { content: ''; float: left; padding-top: 100%; }
). - Each cell contains one digit horizontally and vertically centered within the cell.
- The game should be responsive, so cell's can shrink together with the text on mobile (I'm currently playing with
font-size
and media queries).
I got up to the point where all of these are ok, except the vertically centering of the text within a cell. Anyone knows what the trick is or if that just isn't possible and I should create images for that?