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] - Basic CSS: Size Your Image accepts second image element

See original GitHub issue

Describe your problem and how to reproduce it:

This particular challenge will pass the tests with a second image element under specific conditions:

  • The second image element must also reference the same cat photo url
  • The second image element must come before the first

This code will pass the tests:

<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, monospace;
  }

  p {
    font-size: 16px;
    font-family: monospace;
  }
  .smaller-image {
    width: 100px;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>
<main>
  <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>

 <img src="https://bit.ly/fcc-relaxing-cat" class="smaller-image">

  <a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>

This is a bit of a convoluted edge case, so I am not sure if it warrants a fix or not.

I believe it could be fixed by adding a test (or expanding the existing tests) to assert that $('img').length returns 1.

Related forum post: https://forum.freecodecamp.org/t/change-the-size-double-photo/432740

Add a Link to the page with the problem:

https://www.freecodecamp.org/learn/responsive-web-design/basic-css/size-your-images

Tell us about your browser and operating system:

  • Browser Name: Chrome
  • Browser Version:
  • Operating System: Windows 10 v. 1909

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RandellDawsoncommented, Dec 22, 2020

I’m okay with leaving it as is - we do have an open PR linked to this issue, however.

@nhcarrigan You had responded to the user that nothing had been concluded. We can close this issue and then reference our decision to close this issue in that PR (and close it too).

1reaction
ShaunSHamiltoncommented, Nov 28, 2020

I do not think we should make any change here. It is an odd edge case, to say the least.

The lesson is about adding a class. If the camper has added the class to one image, then they have accomplished the learning outcome.

If something has to change, I would vote for:

Create a class called smaller-image and use it to resize the existing image so that it's only 100 pixels wide.

⬆️ Added the word existing (I realise it is implied, but some do miss it)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic CSS: Size Your Images | freeCodeCamp - YouTube
Today we learn how to use basic CSS to size your images. This is another video in a series in which we teach...
Read more >
Size Your Images Basic CSS via FreeCodeCamp Org - YouTube
FOLLOW ALONG LINK: https://www.freecodecamp.org/learn/responsive-web-design/ basic - css / size - your -imagesCheck out the FreeCodeCamp.org Courses ...
Read more >
<img>: The Image Embed element - HTML - MDN Web Docs
The HTML element embeds an image into the document. ... intrinsic size of the image (the image's display size if no CSS styling...
Read more >
Changing image sizes proportionally using CSS
This is a known problem with CSS resizing. Unless all images have the same proportion, you have no way to do this via...
Read more >
[SOLVED] Size Your Images Error - HTML-CSS
Hello guys. The site finds this error: Your img element should have the class smaller-image. But I've put a class=“smaller-image” to my img ......
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