🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEcss

css Documentation

LOADING ENGINE...

CSS Grid Row

Control vertical positioning in CSS Grid. Master start lines, end lines, and spans.

grid.css
.item {
grid-row: 2 / 4;
/* Starts line 2, ends line 4 */
}
Item
grid-row.css
1 / 8
🏗️

Tutor:Grid Row controls an item's vertical position by defining which row lines it starts and ends at. Let's look at a basic 4x4 grid container.


Grid Mastery Tree

Unlock nodes by learning grid lines and placement.

Concept 1: The Grid Container

Before positioning rows, the parent element must be a grid container (display: grid). The grid lines are numbered starting from 1.

Grid Logic Check

Where does the first row line start?


Grid Architect Hub

Share Layouts

Created a complex grid system? Share your row configurations.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

CSS Grid Row Property

Author

Pascual Vila

CSS Layout Instructor.

The grid-row CSS property is a shorthand for specifying a grid item's size and location within a grid row. It combines grid-row-start and grid-row-end.

Understanding Grid Lines

Grid layout operates on a system of lines. In a 4x4 grid, there are 5 row lines. Row lines are numbered starting from 1 at the top edge of the grid container.

Syntax Breakdown

The syntax uses a forward slash to separate start and end values:

/* start-line / end-line */
grid-row: 1 / 3;

/* start-line / span n */
grid-row: 2 / span 2;

The span Keyword

Often, you don't know the exact end line number, but you know the item should take up 2 rows. The span keyword tells the browser to extend the item across a specific number of tracks from its start position.

Best Practices

Use grid-row to simplify your CSS. Instead of writing two separate properties, you can handle placement in one line. Named grid lines can also be used for more semantic layouts in complex applications.

Grid Glossary

grid-row
Shorthand property for grid-row-start and grid-row-end.
Grid Line
The dividing lines that make up the structure of the grid. Numbered from 1.
span
Keyword used to extend a grid item across a specific number of tracks.
Track
The space between two adjacent grid lines (a row or a column).