What am I still doing wrong here?

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

<h2>CatPhotoApp</h2>
<main>
<img 
src="https://www.freecatphotoapp.com/a relaxing cat jpg."
alt="A relaxing cat"
>
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
</main>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 9; SM-G955F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Mobile Safari/537.36

Challenge: Add Images to Your Website

Link to the challenge:

The src link is incorrect

<img src="https://www.freecatphotoapp.com/your-image.jpg" alt="A relaxing cat">
1 Like

Seda is correct. The link to be used is

https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg

FIRST:
it’s best not to have linebreaks in the IMG Elements

Screenshot 2022-04-08 7.45.36 AM


This is a better format

Screenshot 2022-04-08 7.46.33 AM


SECOND:
These URLs don’t end in a period (.)

Screenshot 2022-04-08 7.49.36 AM

I’m not sure if the freeCodeCamp tests will have trouble with linebreaks, but generally speaking, it’s not uncommon to use linebreaks inside of an HTML element if it makes it more readable (typically if the attributes exceed a certain length).

Hahahhah…
That is Correct. FreeCodeCamp will accept the html even when It look like thie:

You could do it like this, and It could read fine. It would just be considered a really Poor Choice, and your Co-workers will learn to hate you.

1 Like

Right, it will break on linebreaks inside of strings for URLs though since that is malformed syntax. We see that error often for people working on a mobile device.

Hmm, though not uniformly will it break with linebreaks in URLs it seems. Odd

That would certainly be obnoxious, but breaking long tags along attributes is different. This, for example, is a piece of code from work that I happened to have open in my editor right now:

It is definitely very common with frameworks because components often will end up with a lot of props.

But if you use a code formatter like Prettier which has a maximum line length rule it will also format plain HTML that way.

Prettier format:

<img
  src="https://www.freecatphotoapp.com/your-image.jpg"
  alt="A relaxing cat"
/>
2 Likes

Thank you very much for your concern

It’s not bad looking
In a way, it’s very tidy and easier to read for possible errors.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.