Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Titre du 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; } .auto-box1 { grid-area: 1 / 1 / 2 / 2; } .auto-box2 { grid-area: 1 / 2 / 2 / 3; } .auto-box3 { grid-area: 1 / 3 / 2 / 4; } .auto-box4 { grid-area: 2 / 1 / 3 / 2; } .auto-box5 { grid-area: 2 / 2 / 3 / 3; } .auto-box6 { 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; } .auto-container { display: grid; grid-auto-rows: auto; grid-gap: 10px; background-color: #ccc; padding: 10px; } .auto-container > div { background-color: #666; text-align: center; padding: 20px 0; font-size: 20px; } </style> </head> <body> <h2>Exemple de la propriété grid-auto-rows </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>auto</h3> <div class="auto-container"> <div class="auto-box1">1</div> <div class="auto-box2">2</div> <div class="auto-box3">3</div> <div class="auto-box4">4</div> <div class="auto-box5">5</div> <div class="auto-box6">6</div> </div> </body> </html>