Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

CSS Properties

CSS grid-row-start Property

Posted in CSS Tutorial
Updated on Oct 03, 2024
By Mari Selvan
👁️ 10 - Views
⏳ 4 mins
💬 1 Comment
CSS grid-row-start Property

Photo Credit to CodeToFun

🙋 Introduction

The grid-row-start property in CSS is used in Grid Layout to specify the starting position of a grid item within a grid container.

This property defines on which row line a grid item will start, providing control over the placement and layout of grid items.

💡 Syntax

The syntax for the grid-row-start property is as follows:

Syntax
Copied
Copy To Clipboard
element {
  grid-row-start: value;
}

🎛️ Default Value

The default value of the grid-row-start property is auto, which means the item will be placed according to the default positioning rules of the grid layout.

🏠 Property Values

ValueDescription
autoPlaces the item in the next available slot in the grid.
line numberSpecifies the grid line number where the item should start.
span valueIndicates the item should span across a number of rows, starting from its current position.
nameA named grid line defined in the grid container.

📄 Example

In this example, we'll demonstrate the use of the grid-row-start property by creating a simple grid layout and positioning a grid item to start at a specific row.

index.html
Copied
Copy To Clipboard
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS grid-row-start Example</title>
  <style>
    .grid-container {
      display: grid;
      grid-template-rows: repeat(4, 100px);
      gap: 10px;
      border: 1px solid #ccc;
    }
    .grid-item {
      background-color: #76c7c0;
      padding: 20px;
      text-align: center;
    }
    .item1 {
      grid-row-start: 3;
    }
  </style>
</head>
<body>
  <h1>Grid Row Start Example</h1>
  <div class="grid-container">
    <div class="grid-item">Item 1</div>
    <div class="grid-item item1">Item 2 (Starts at Row 3)</div>
    <div class="grid-item">Item 3</div>
    <div class="grid-item">Item 4</div>
  </div>
</body>
</html>

🖥️ Browser Compatibility

The grid-row-start property is widely supported in modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. It is advisable to verify its compatibility with any specific versions of browsers you aim to support.

🎉 Conclusion

The grid-row-start property is a powerful feature in CSS Grid Layout that offers precise control over the positioning of grid items.

By specifying the starting row line for an item, you can create complex and flexible grid layouts that adapt to various design requirements. Experiment with different values to see how this property can enhance the structure and appearance of your web projects.

👨‍💻 Join our Community:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.

Buy me a coffee to make codetofun.com free for everyone.

Buy me a Coffee

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy