07-26-2023, 07:30 PM
Description:
CSS Grid is a powerful layout system that allows you to create complex two-dimensional grid-based layouts. It enables you to define rows and columns and place items within the grid, providing precise control over the layout of your web pages.
Example:
<!DOCTYPE html>
<html>
<head>
<title>CSS Grid Example</title>
<style>
/* Create a 3x3 grid layout */
.grid-container {
display: grid;
grid-template-columns: repeat(3, 100px);
grid-template-rows: repeat(3, 100px);
grid-gap: 10px;
}
.grid-item {
background-color: lightblue;
padding: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
</body>
</html>
CSS Grid is a powerful layout system that allows you to create complex two-dimensional grid-based layouts. It enables you to define rows and columns and place items within the grid, providing precise control over the layout of your web pages.
Example:
<!DOCTYPE html>
<html>
<head>
<title>CSS Grid Example</title>
<style>
/* Create a 3x3 grid layout */
.grid-container {
display: grid;
grid-template-columns: repeat(3, 100px);
grid-template-rows: repeat(3, 100px);
grid-gap: 10px;
}
.grid-item {
background-color: lightblue;
padding: 10px;
text-align: center;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
</body>
</html>