Skip to main content

no-zero-grid-lines

Disallow line 0 in CSS Grid placement declarations.

CSS Grid line numbering starts at 1 from the start edge and -1 from the end edge. Line 0 does not exist, so placement values using 0 are invalid.

Incorrectโ€‹

.item {
grid-column: 0 / 2;
}
.item {
grid-row-end: 0;
}

Correctโ€‹

.item {
grid-column: 1 / -1;
}
.item {
grid-row: var(--row-start) / var(--row-end);
}

Stylelint Configโ€‹

export default {
plugins: ["stylelint-plugin-grid"],
rules: {
"grid/no-zero-grid-lines": true
}
};