HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> #outerDiv{ display: grid; border: 1px solid black; grid-template-areas: 'myArea . .'; } #outerDiv div{ border: 1px solid #00f; background-color: rgba(0,0,255,.2); padding: 25px; margin: 8px; text-align: center; } #outerDiv div:nth-child(1){ grid-area: myArea; } </style> </head> <body> <h1>CSS grid-template-areas Property</h1> <div id="outerDiv"> <div>Div 1</div> <div>Div 2</div> <div>Div 3</div> <div>Div 4</div> <div>Div 5</div> <div>Div 6</div> <div>Div 7</div> </div> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementById("outerDiv"); function myFunction(){ x.style.gridTemplateAreas = "'myArea myArea myArea'"; } </script> <p><strong>Note</strong>: Click on the button to set css 'grid-template-areas' property from 'myArea . .' to 'myArea myArea myArea'.</p> </body> </html>
OUTPUT
×

Save as Private