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:- How to run Gradle build in offline mode - Gradle
- [Fix] Microsoft Windows OneDrive 0x8007018b Error Code - Windows
- List of jar files for Jax-ws (SOAP) based Java Web Services - Java
- Manually Throw an Exception in Python (raise:) - Python
- import servlet API to eclipse project (javax.servlet cannot be resolved error) - Java
- Bash Command to Check Python Version - Bash
- How to install pip on macOS using terminal command [Python] - Python
- Fix Power BI 404 not found error when connecting SharePoint Online List as Data Source - SharePoint