Back to Freecodecamp

Step 8

curriculum/challenges/english/blocks/learn-html-by-building-a-cat-photo-app/5dc24073f86c76b9248c6ebb.md

latest2.1 KB
Original Source

--description--

HTML <dfn>attributes</dfn> are special words used inside the opening tag of an element to control the element's behavior. The src attribute in an img element specifies the image's URL (where the image is located).

Here is an example of an img element with a src attribute pointing to the freeCodeCamp logo:

html

Inside the existing img element, add a src attribute with this URL:

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

--hints--

Your code should have an img element. You may have removed the img element or you have not surrounded the src attribute's value with quotes.

js
assert(document.querySelector('img'));

Your img element should have a src attribute. You have either omitted the attribute or have a typo. Make sure there is a space between the element name and the attribute name.

js
assert(document.querySelector('img').src);

Your img element's src attribute should be set to 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg'. You have either omitted the URL or have a typo. The case of the URL is important.

js
assert.strictEqual(document.querySelector('img').src, 'https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg');

Although you have set the img element's src to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.

js
assert.notMatch(code, /\` or `/>`.

```js
assert.match(code, //);

--seed--

--seed-contents--

html
<html>
  <body>
    <main>
      <h1>CatPhotoApp</h1>
      <h2>Cat Photos</h2>
      <!-- TODO: Add link to cat photos -->
      <p>Everyone loves cute cats online!</p>
--fcc-editable-region--
      
--fcc-editable-region--
    </main>
  </body>
</html>