feat: Improve tile spacing to prevent overlapping

- Increase margin between grid cells from 15px to 18px
- Update JavaScript positioning to match new spacing (124.25px)
- Increase game container size from 500px to 512px to accommodate larger grid
- Fix visual issue where tiles appeared too close together
This commit is contained in:
Greg
2025-07-01 10:42:46 -07:00
parent a419767e89
commit db01a880a7
2 changed files with 7 additions and 7 deletions

View File

@@ -246,8 +246,8 @@ class Game2048 {
const tile = document.createElement('div');
tile.className = `tile tile-${this.grid[row][col]}`;
tile.textContent = this.grid[row][col];
tile.style.left = `${col * 121.25}px`;
tile.style.top = `${row * 121.25}px`;
tile.style.left = `${col * 124.25}px`;
tile.style.top = `${row * 124.25}px`;
if (this.grid[row][col] > 2048) {
tile.className = 'tile tile-super';

View File

@@ -25,7 +25,7 @@ h1.title {
}
.container {
width: 500px;
width: 512px;
margin: 0 auto;
}
@@ -141,8 +141,8 @@ h1.title {
touch-action: none;
background: #bbada0;
border-radius: 10px;
width: 500px;
height: 500px;
width: 512px;
height: 512px;
box-sizing: border-box;
}
@@ -208,7 +208,7 @@ h1.title {
}
.grid-row {
margin-bottom: 15px;
margin-bottom: 18px;
}
.grid-row:last-child {
@@ -220,7 +220,7 @@ h1.title {
height: 106.25px;
background: rgba(238, 228, 218, 0.35);
border-radius: 6px;
margin-right: 15px;
margin-right: 18px;
float: left;
}