CodeLab
Tutorials For Everyone
Run
<!DOCTYPE html> <html> <head> <style> /* ============== grid-template-columns ============== */ .grid-container { display: grid; grid-template-columns: 20% 60% 20%; grid-template-rows: auto auto; padding-right: 10px; grid-gap: 5px; background: #333; } .grid-item { position: relative; background: #97ff99; border: 1px solid #333; text-align: center; padding: 10px; height: 50px; line-height: 50px; } /* ============== grid-template-columns ============== */ </style> </head> <body> <h1 class="heading">grid-template-columns</h1> <p class="description">We can decide the width of the columns using the <code>grid-template-columns</code> CSS property.</p> <div class="grid-container"> <div class="grid-item">1</div> <div class="grid-item">2</div> <div class="grid-item">3</div> <div class="grid-item">4</div> <div class="grid-item">5</div> <div class="grid-item">6</div> </div> </body> </html>