Snippets
Reusable code snippets for Python, JavaScript, HTML, CSS, SQL, and more. Copy and use in your projects.
CSS Grid Responsive Auto-Fit
Truly responsive grid without media queries — columns automatically fit and reflow based on container width.
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 1rem;
}gridresponsivelayout 59
Open pageCenter a Div (Flexbox)
The classic "how do I center a div" — solved in 3 lines with flexbox. Works horizontally and vertically.
.parent {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}flexboxcenteringlayout 40
Open page