content icon indicating copy to clipboard operation
content copied to clipboard

Confusing/misleading example

Open kevin-powell opened this issue 1 year ago • 4 comments

MDN URL

https://developer.mozilla.org/en-US/docs/Web/CSS/grid

What specific section or headline is this issue about?

Syntax

What information was incorrect, unhelpful, or incomplete?

In the syntax examples, there are two examples that I believe are misleading. They are similar examples, one for repeating rows, and one for repeating columns.

/* <'grid-template-rows'> /
   [ auto-flow && dense? ] <'grid-auto-columns'>? values */
grid: repeat(3, 200px) / auto-flow 300px;

/* [ auto-flow && dense? ] <'grid-auto-rows'>? /
   <'grid-template-columns'> values */
grid: auto-flow 300px / repeat(3, 200px);

The 3rd example in each uses of those sections (which I've isolated above), uses repeat(3, [line1 line2 line3] 200px);. When reading this, I believe most people would assume this will name the lines "line1", "line2", "line3" respectively, but instead, it assigns all three names to each of the lines. Using the repeat with multiple line names doesn't have much practical value (that I can think of).

Image

.

What did you expect to see?

I think it would be best to remove the name entirely, because having the same name across each column isn't very useful in my opinion, but there might be use cases I'm missing, in which case having a single line name would make more sense.

Do you have any supporting links, references, or citations?

I set up a demo of it here. Using Chrome's devtools, you can see the line names for each column are "line1 line2 line3".

Here is a screenshot showing it: Image

Do you have anything more you want to share?

No response

MDN metadata

Page report details
  • Folder: en-us/web/css/grid
  • MDN URL: https://developer.mozilla.org/en-US/docs/Web/CSS/grid
  • GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/css/grid/index.md
  • Last commit: https://github.com/mdn/content/commit/0cc9980e3b21c83d1800a428bc402ae1865326b2
  • Document last modified: 2025-07-14T14:43:58.000Z

kevin-powell avatar Sep 17 '25 15:09 kevin-powell

Hi, are you interested in trying to improve this example?

Josh-Cena avatar Sep 17 '25 15:09 Josh-Cena

Sure, I'll see what I can come up with 👍

Do I just need to submit a PR for that page, or would I mention anything here?

kevin-powell avatar Sep 17 '25 17:09 kevin-powell

You just need to submit a PR, and then we can move the discussion over there.

Josh-Cena avatar Sep 17 '25 18:09 Josh-Cena

I’m happy to work on improving these grid syntax examples and propose clearer alternatives that better reflect how line names actually behave.

xopsio avatar Jan 31 '26 12:01 xopsio