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.

Applied Visual Design: Adjust the Height of an Element Using the height Property - correct solution does not pass

See original GitHub issue

Describe your problem and - if possible - how to reproduce it

When you provide the correct code the test still fails, this is do to the tests passing the true height of the element and not what the CSS is set to. This issue occurs mainly on smaller resolutions because the height of the element is smaller and converted by the browser.

In my Dev Tools it was saying the true height of the element was 24.99px and when I would scroll out the browser converted the true height to 25.01px. I had to find a sweet spot in my zoom level to where it was exactly 25px.

The fix is to change the test to use regex and not use assert($('h4').css('height') == '25px'

Additional users having issues: https://forum.freecodecamp.org/t/applied-visual-design-adjust-the-height-of-an-element-using-the-height-property/199328/5

Add a Link to the page with the problem

https://learn.freecodecamp.org/responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property/

Tell us about your browser and operating system

  • Browser Name: Chrome
  • Browser Version:
  • Operating System:

If possible, add a screenshot here

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
nathanhannigcommented, Aug 28, 2018

Go fo it.

I also noticed the same when zoomed in very far on your screen resolution for https://learn.freecodecamp.org/responsive-web-design/responsive-web-design-principles/use-a-retina-image-for-higher-resolution-displays

test must be looking at the computed true value of the element instead of the css code that is defining it. Bad practice.

1reaction
RandellDawsoncommented, Nov 7, 2019

@lasjorg How close are we to a cross-browser way to test this? If it is getting too complicated, maybe we should use regex against the code as a fix for now and keep the discussion going in this issue. I would prefer a less elegant regex fix now because the forum is seeing the same topics over and over related to the bugs in these two challenges.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Applied Visual Design: Adjust the ... - The freeCodeCamp Forum
I am very confused here on why this part is not working: Your code so far <br> <style> h4 { text-align: center; height:...
Read more >
FreeCodeCamp: Applied Visual Design - Eleftheria Batsou
Adjust the Height of an Element Using the height Property. You can specify the width of an element using the width property in...
Read more >
10 Visual formatting model details - W3C
This property does not apply to non-replaced inline elements. ... Note: In cases where an explicit width or height is set and the...
Read more >
position - CSS: Cascading Style Sheets - MDN Web Docs
The position CSS property sets how an element is positioned in a document ... positioned elements that have height and width set to...
Read more >
Setting Height And Width On Images Is Important Again
With no image dimensions, you can get away with just specifying max-width: 200px in the CSS without having to specify height: auto and...
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