HTML Code:
<div class="grid-container">
<div class="grid">Gird 1</div>
<div class="grid">Grid 2</div>
<div class="grid">Grid 3</div>
<div class="grid">Gird 4</div>
<div class="grid">Grid 5</div>
<div class="grid">Grid 6</div>
</div>
CSS Grid Style Code:
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 20px;
}
.grid {
background-color: lightgray;
border: 2px inset #333;
border-radius: 10px;
padding: 25px;
text-align: center;
}
CSS Grid Example Output:
Gird 1
Grid 2
Grid 3
Gird 4
Grid 5
Grid 6
Facing issues? Have Questions? Post them here! I am happy to answer!
Author Info:
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
More Posts related to CSS,
- How to create a circular Image using pure CSS Code
- Horizontally Center Align tag in HTML using CSS
- Add scroll to div element in HTML Css
- Change CSS Background Opacity with Examples
- How to make text bold using CSS
- How to place two div elements next to each other
- Vertically Center Text in a DIV Element
- align image at middle of div element
- Tailwind CSS Hello World Example
- How to make div or text in html unselectable using CSS
- Only Chessboard using HTML and CSS Code Example
- Simple CSS Grid Example
- How to set CSS background-Image Property
- CSS Background Opacity with Examples
- reCAPTCHA Implementation Tutorial
- List of 32 CSS cursors web developers must know about
- How to Vertically Center Align Text in a Div using CSS Code Example
- 10 Must Know CSS Border Styles with Examples
- Tutorial : Simple Lightweight Pure CSS based Vertical Navigation Menu
- CSS: Apply opacity only for div background and not text
- Set Falling Show on Website for Christmas using Pure CSS Code
- How to make jsfiddle bootstrap ready
- Elegant CSS Box Shadows Ideas
- Responsive Web Design with CSS Media Queries: A Beginner's Tutorial [Updated for 2023]
- How to Center Align Image in Bootstrap
More Posts:- Create SharePoint Site Collection with new Content database in existing web application - SharePoint
- Change Mac Default Browser [updated for macOS Ventura] - MacOS
- Fix Power Automate FLOW error - InvalidTemplate Unable to process template language expressions in action - Microsoft
- What is list[-1] in Python Programming - Python
- Fix: E: Command line option --installed is not understood in combination with the other options - Ubuntu
- Define an Infinite Number in Python - Python
- How to: Docker Remove Image - Docker
- Fix: ValueError: unsupported pickle protocol: 5 - Python