- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set areas within the grid layout in CSS
To set the areas within the grid layout, use the grid-template-areas Property. Let us now see an example −
Example
<!DOCTYPE html> <html> <head> <style> .demo { grid-area: newArea; } .grid-container { display: grid; grid-template-areas: 'newArea newArea . . .' 'newArea newArea . . .'; grid-gap: 5px; background-color: blue; padding: 5px; } .grid-container > div { background-color: orange; text-align: center; padding: 5px 0; font-size: 30px; } </style> </head> <body> <h1>Heading One</h1> <p>Set some random numbers</p> <div class="grid-container"> <div class="demo">250</div> <div class="item2">120</div> <div class="item3">333</div> <div class="item4">298</div> <div class="item5">645</div> <div class="item6">543</div> <div class="item7">555</div> </div> </body> </html>
Output
- Related Articles
- CSS Grid Layout
- Define the number of columns in CSS Grid Layout
- Define the width of each column in CSS Grid Layout
- Specify the number of columns in a CSS grid layout
- Specify the size of the rows in a CSS grid layout
- Set the grid template property in CSS
- How to create a 2-column layout grid with CSS?
- How to create a 3-column layout grid with CSS?
- How to create a 4-column layout grid with CSS?
- How to create a mixed column layout grid with CSS?
- Set where to end the CSS grid item
- Set the name to Grid Items with CSS
- Set the size of the gap between CSS grid columns
- Set how auto-placed items are inserted in the CSS grid
- Set a default row size for CSS Grid

Advertisements