Grid-Row-Start
The grid-row-start property defines on which row-line the item will start.
Syntax:
grid-row-start: auto|row-line;
Where,
auto: Default value. The item will be placed by following the flow.
row-line: Specifies on which row to start the display of the item.
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.grid-container {
display: grid;
grid-template-columns: auto auto auto auto;
grid-gap: 10px;
background-color: red;
padding: 10px;
}
.grid-container > div {
background-color: rgba(255, 255, 255, 0.8);
text-align: center;
padding: 20px 0;
font-size: 30px;
}
.item1 {
grid-row-start: 2;
}
</style>
</head>
<body>
<h2>Grid-Row-Start Property</h2>
<p>Item1 will start on row 2:</p>
<div class="grid-container">
<div class="item1">1</div>
<div class="item2">2</div>
<div class="item3">3</div>
<div class="item4">4</div>
<div class="item5">5</div>
<div class="item6">6</div>
</div>
</body>
</html>
Output:
Grid-Row-End
The grid-row-end property defines how many rows an item will span, or on which row-line the item will end.
Syntax:
grid-row-end: auto|row-line|span n;
Where,
auto: Default Value. The Item will span one row.
row-line: Specifies the number of row the item will span.
Span n: Specifies on which row to end the display of the item.
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.grid-container {
display: grid;
grid-template-columns: auto auto auto;
grid-gap: 10px;
background-color: red;
padding: 10px;
}
.grid-container > div {
background-color: rgba(255, 255, 255, 0.8);
text-align: center;
padding: 20px 0;
font-size: 30px;
}
.item2 {
grid-row-end: span 3;
}
</style>
</head>
<body>
<h2>Grid-Row-End Property</h2>
<p>Item2 will span 3 rows:</p>
<div class="grid-container">
<div class="item1">1</div>
<div class="item2">2</div>
<div class="item3">3</div>
<div class="item4">4</div>
<div class="item5">5</div>
<div class="item6">6</div>
<div class="item7">7</div>
</div>
</body>
</html>
Output:
The Tech Platform
Comments