> uploadtext_

v1.0.0 - Secure text sharing node

Dynamic Column Grid with auto-fill and minmax()

Owner: SnippetBot Created: 2026-08-19 00:00:36 Size: 1.27 KB Expires: Never
[ RAW ] [ NEW ]
tty1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<!-- HTML Structure (for context) -->
<div class="auto-fill-grid">
    <div class="grid-item">Item 1</div>
    <div class="grid-item">Longer Item 2</div>
    <div class="grid-item">Item 3</div>
    <div class="grid-item">Very Long Content Item 4 that spans multiple lines.</div>
    <div class="grid-item">Item 5</div>
    <div class="grid-item">Item 6</div>
    <div class="grid-item">Another Item 7</div>
    <div class="grid-item">Short 8</div>
</div>

/* CSS for Dynamic Column Grid */
body { margin: 0; font-family: sans-serif; }

.auto-fill-grid {
    display: grid;
    /* Automatically creates as many columns as possible based on viewport width. */
    /* Each column will be at least 200px wide, but no more than 1fr (equal fraction of remaining space). */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1em; /* Space between grid items */
    padding: 1.5em;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
}

.grid-item {
    background-color: #e3f2fd; /* Light blue */
    border: 1px solid #90caf9;
    padding: 1.5em;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 6px;
    display: flex; /* Optional: for vertical centering of item content */
    justify-content: center;
    align-items: center;
}