.grid-container { display: grid; /* Automatically adjust column count based on available space. 'auto-fit' will expand items to fill extra space if fewer than max fit. 'minmax(250px, 1fr)' ensures items are at least 250px wide and share space equally. */ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; padding: 20px; background-color: #f9f9f9; } .grid-item { background-color: #e0f7fa; /* Light blue */ border: 1px solid #00bcd4; /* Cyan */ border-radius: 5px; padding: 20px; text-align: center; min-height: 120px; display: flex; justify-content: center; align-items: center; font-family: sans-serif; font-size: 1.2em; color: #333; } /* Example HTML structure: