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:- Python: If Else Statements in One Single Line - Python
- Replace new line with comma in Sublime Text Editor - Sublime-Text
- Programmatically check if Facebook is installed on Android device - Android
- How to Toggle Dark and Light Mode on macOS Sonoma 14 - MacOS
- How to install Anaconda on Mac (M1/M2 Mac) - Python
- How to ls command to output one entry per line [macOS/Linux/Bash] - Linux
- Grep Alternative for Windows CMD or PowerShell: findstr - Windows
- How to Run PowerShell Script as Administrator (Elevate) - Powershell