
- CSS - Home
- CSS - Roadmap
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Types
- CSS - Measurement Units
- CSS - Selectors
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS - Cascading
- CSS - Universal Selectors
- CSS - ID Selectors
- CSS - Group Selectors
- CSS - Class Selectors
- CSS - Child Selectors
- CSS - Element Selectors
- CSS - Descendant Selectors
- CSS - General Sibling Selectors
- CSS - Adjacent Sibling Selectors
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Advanced Features
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS Interview Questions
- CSS Online Quiz
- CSS Online Test
- CSS Mock Test
- CSS - Quick Guide
- CSS - Cheatsheet
- CSS - Properties References
- CSS - Functions References
- CSS - Color References
- CSS - Web Browser References
- CSS - Web Safe Fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS - grid-row-end Property
CSS grid-row-end property determines the row where a grid item should end by specifying a line, a span, or relying on automatic placement. It defines block-end edge of the grid area.
Syntax
grid-row-end: auto | span n | row-line;
Property Values
Value | Description |
---|---|
auto | It automatically determines the position of the grid item within the grid layout. Deafult span of 1. |
span n | It specifies the number of rows space taken by the element. |
row-line | It specifies the row on which the display of the element must end. |
Examples of CSS Grid row End Property
The following examples explain the grid-row-end property with different values.
Grid Row End Property with Auto Value
To allow the grid item to end at the default position based on the item's content and the grid layout, we use the auto value. It automatically adjusts the end line based on how much space the item needs and its current placement within the grid. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .grid-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px; background-color: #f0f0f0; } .grid-item { background-color: lightcoral; border: 3px solid blue; padding: 20px; text-align: center; color: white; grid-row-end: auto; } </style> </head> <body> <h2> CSS grid-row-end property </h2> <h4> grid-row-end: auto </h4> <div class="grid-container"> <div class="grid-item item1 items"> Item 1 </div> <div class="grid-item"> Item 2 </div> <div class="grid-item item3 items"> Item 3 </div> <div class="grid-item"> Item 4 </div> <div class="grid-item item5 items"> Item 5 </div> </div> </body> </html>
Grid Row End Property with Span Values
To make the the grid item extend from its starting line and span across n number of rows, we specify the number of rows with the span (e.g. span 2- the element spans 2 rows from the starting line). This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .grid-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px; background-color: #f0f0f0; } .grid-item { background-color: lightcoral; border: 2px solid #ff6b6b; padding: 20px; text-align: center; color: white; } .items { border: 3px solid blue; } .item1 { grid-row-end: span 2; } .item3 { grid-row-end: span 3; } .item4 { grid-row-end: span 4; } </style> </head> <body> <h2> CSS grid-row-end property </h2> <h4> grid-row-end: span 2 (item1), span 3 (item3), span 4 (item5) </h4> <p> item1- the element takes 2 rows space </p> <p> item3- the element takes 3 rows space </p> <p> item5- the element takes 4 rows space </p> <div class="grid-container"> <div class="grid-item item1 items"> Item 1 </div> <div class="grid-item"> Item 2 </div> <div class="grid-item item3 items"> Item 3 </div> <div class="grid-item item4 items"> Item 4 </div> <div class="grid-item"> Item 5 </div> </div> </body> </html>
Grid Row End Property with Row Numbers
To set the grid item's end line explicitly at some row line number where the item should end irrespective of the starting line, we specify the row number (e.g. 3 - the element must be displayed till row-line 3). This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .grid-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px; background-color: #f0f0f0; } .grid-item { background-color: lightcoral; border: 2px solid #ff6b6b; padding: 20px; text-align: center; color: white; } .items { border: 3px solid blue; } .item1 { grid-row-end: 3; } .item3 { grid-row-end: 4; } .item4 { grid-row-end: 5; } </style> </head> <body> <h2> CSS grid-row-end property </h2> <h4> grid-row-end: 3 (item1), 4 (item3), 5 (item5) </h4> <p> item1- the display of the item ends at row-line 2 </p> <p> item3- the display of the item ends at row-line 3 </p> <p> item5- the display of the item ends at row-line 4 </p> <div class="grid-container"> <div class="grid-item item1 items"> Item 1 </div> <div class="grid-item"> Item 2 </div> <div class="grid-item item3 items"> Item 3 </div> <div class="grid-item item4 items"> Item 4 </div> <div class="grid-item"> Item 5 </div> </div> </body> </html>
Supported Browsers
Property | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
grid-row-end | 57 | 16 | 52 | 10 | 44 |