Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> .box1 { grid-area: 1 / 1 / 2 / 2; } .box2 { grid-area: 1 / 2 / 2 / 3; } .box3 { grid-area: 1 / 3 / 2 / 4; } .box4 { grid-area: 2 / 1 / 3 / 2; } .box5 { grid-area: 2 / 2 / 3 / 3; } .box6 { grid-area: 2 / 3 / 3 / 4; } .minmax1 { grid-area: 1 / 1 / 2 / 2; } .minmax2 { grid-area: 1 / 2 / 2 / 3; } .minmax3 { grid-area: 1 / 3 / 2 / 4; } .minmax4 { grid-area: 2 / 1 / 3 / 2; } .minmax5 { grid-area: 2 / 2 / 3 / 3; } .minmax6 { grid-area: 2 / 3 / 3 / 4; } .grid-container { display: grid; grid-auto-rows: 100px; grid-gap: 10px; background-color: #ccc; padding: 10px; } .grid-container > div { background-color: #666; text-align: center; padding: 20px 0; font-size: 20px; } .minmax-container { display: grid; grid-auto-rows: minmax(90px, 4cm); grid-gap: 10px; background-color: #cccccc; padding: 10px; } .minmax-container > div { background-color: #f5f5f5; text-align: center; padding: 20px 0; font-size: 20px; } </style> </head> <body> <h2>Grid-auto-rows property example</h2> <h3>100 pixels</h3> <div class="grid-container"> <div class="box1">1</div> <div class="box2">2</div> <div class="box3">3</div> <div class="box4">4</div> <div class="box5">5</div> <div class="box6">6</div> </div> <h3>minmax</h3> <div class="minmax-container"> <div class="minmax1">1</div> <div class="minmax2">2</div> <div class="minmax3">3</div> <div class="aminmax4">4</div> <div class="minmax5">5</div> <div class="minmax6">6</div> </div> </body> </html>