question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug in CSS Grid: Use grid-column to Control Spacing

See original GitHub issue

Describe your problem and how to reproduce it: Correct solution lets you not pass test. The grid-column: 2 / 4; is called in the next challenge and even being refered to as well.

Add a Link to the page with the problem: https://www.freecodecamp.org/learn/responsive-web-design/css-grid/use-grid-column-to-control-spacing

Tell us about your browser and operating system:

  • Browser Name: Google Chrome
  • Browser Version: 78.0.3904.97 (Official Build) (64-bit)
  • Operating System: macOS

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box): Screenshot 2019-11-08 at 22 58 59

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:28 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
moT01commented, Nov 10, 2019

window.getComputedStyle(document.querySelector(‘.item5’)).gridColumn // “2 / 4”

I would go for something like that from @lasjorg’s comment. Here’s what I came up with…

testString: const gridStart = getComputedStyle($('.item5')[0]).gridColumnStart;
const gridEnd = getComputedStyle($('.item5')[0]).gridColumnEnd;
const result = gridStart.toString() + gridEnd.toString();
assert(result === "24" || result === "2-1" || result === "2span 2" || 
result === "2span2" || result === "span 2-1" || result === "-12");

I tested this locally on firefox and it looks to be working.

1reaction
ojeytonwilliamscommented, Nov 9, 2019

@sascharissling thanks for taking the time to work through this. Those screenshots are a massive help. @RandellDawson how about jumping up to 1? That should still avoid false positives since the wrong answers are out by a lot more than that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug? in CSS Grid: Use grid-column to Control Spacing
In “CSS Grid: Use grid-column to Control Spacing” we are asked to “Make the item with the class item5 consume the last two...
Read more >
Preventing a Grid Blowout | CSS-Tricks
To apply our fix, we need to make sure that there is the column has a definite minimum width instead of auto ....
Read more >
column-gap - CSS: Cascading Style Sheets - MDN Web Docs
Note that grid-column-gap is an alias for this property. ... The browser's default spacing is used between columns. For multi-column layout ...
Read more >
Grid - web.dev
CSS Grid Layout provides a two dimensional layout system, controlling layout in rows and columns. In this module discover everything grid has to...
Read more >
Why does CSS Grid layout add extra gaps between cells?
The vertical gaps are caused by the images not filling the vertical space in the grid items. The problem is made worse with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found