Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,895 questions

51,826 answers

573 users

How to have as many have as many columns as will fit into a grid container in CSS

2 Answers

0 votes
<!DOCTYPE html> 
<html> 
    <head> 
        <style>
            .grid-container {
                display: grid;
                grid-gap: 10px;
                grid-template-columns: repeat(auto-fill, 220px);
                background-color: blue;
                padding: 10px;
            }
            .grid-container > div {
                background-color: lightblue;
                border: 1px solid;
                padding: 15px;
            }
        </style>
    </head> 
    <body> 
        <div class="grid-container">
            <div class="grid-item1">a</div>
            <div class="grid-item2">b</div>
            <div class="grid-item3">c</div> 
            <div class="grid-item4">d</div>
            <div class="grid-item5">e</div>            
            <div class="grid-item6">f</div>
        </div>
    </body> 
</html>

 



answered Jun 5, 2019 by avibootz
0 votes
<!DOCTYPE html> 
<html> 
    <head> 
        <style>
            .grid-container {
                display: grid;
                grid-gap: 10px;
                grid-template-columns: repeat(auto-fill, minmax(220px, auto));
                background-color: blue;
                padding: 10px;
            }
            .grid-container > div {
                background-color: lightblue;
                border: 1px solid;
                padding: 15px;
            }
        </style>
    </head> 
    <body> 
        <div class="grid-container">
            <div class="grid-item1">a</div>
            <div class="grid-item2">b</div>
            <div class="grid-item3">c</div> 
            <div class="grid-item4">d</div>
            <div class="grid-item5">e</div>            
            <div class="grid-item6">f</div>
        </div>
    </body> 
</html>

 



answered Jun 5, 2019 by avibootz

Related questions

5 answers 499 views
5 answers 539 views
3 answers 344 views
1 answer 233 views
1 answer 301 views
1 answer 225 views
225 views asked Jan 7, 2021 by avibootz
...