messes up formatting of css grid layout
See original GitHub issueCSS Grid layout encourages a somewhat special syntax where the lines of the rule represent the grid being described. For example this rule:
.item {
grid-template-areas:
"header header"
"main sidebar"
"footer footer";
}
describes the grid areas for a 2-column, 3-row grid. You’d want to keep the formatting just like this because it’s easier to understand when it’s laid out the same way as the grid being described.
Same goes for the grid-template-columns
, grid-template-rows
, and grid-template
properties. Another example:
.item {
grid-template:
"a a a" 200px
"b b b" 200px
/ 200px 200px auto;
}
Having it on separate lines like this makes it easier to understand which part of the CSS correlates to specific rows/columns.
Prettier currently concats everything to a single line, when ideally it should only handle indents and semicolons for these cases.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:31 (13 by maintainers)
Top Results From Across the Web
CSS Grid Layout and progressive enhancement
If you're supporting an old codebase with floated layouts, there will be no conflict. Grid items ignore the float property; the fact is...
Read more >Preventing a Grid Blowout | CSS-Tricks
In our simple demo, the <main> element automatically places itself in that first column as it is the first child of the grid....
Read more >Wes Bos on Twitter: "Anyone know if Prettier can format multi ...
Anyone know if Prettier can format multi-line css when doing grid-template-*? It currently does this: Embedded video.
Read more >Why doesn't my HTML structure work with the CSS Grid layout?
I am trying to understand how HTML structure affects the CSS Grid Layout Module spec. I'm using Chrome Canary with experimental features ...
Read more >A CSS Grid Layout with Pictures Down One Side Matched Up ...
It's a satisfying answer, because we can pull this off with simple semantic markup and a few lines of CSS grid. And yet!...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
(P.S. Don’t let all that craziness above deter you from learning CSS Grid. Basic use cases are much simpler and easy to pick up. You will never need near as much code as everything in the example above)
Hah. I hope I do. I wrote a chapter on it 😜 (https://www.manning.com/books/css-in-depth)
Below are several examples for all property names that begin with
grid
. (There are other grid-related ones, likejustify-content
that don’t havegrid
in the name and can probably be formatted as normal).