freeCodeCamp/curriculum/challenges/english/01-responsive-web-design/basic-html-cat-photo-app/part-029.md

98 lines
2.4 KiB
Markdown

---
id: 5efae0543cbd2bbdab94e333
title: Part 29
challengeType: 0
dashedName: part-29
---
# --description--
To improve accessibility of the image you just added, add an `alt` attribute with the text `Five cats looking around a field.`
# --hints--
Your `figure` element should have an opening tag. Opening tags have this syntax: `<elementName>`.
```js
assert(document.querySelectorAll('figure').length === 2);
```
Your `ol` element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js
assert(code.match(/<\/figure>/g).length === 2);
```
There should be a `figure` element right above the last `section` element's closing tag.
```js
assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE');
```
The Cats `img` element should be nested in the `figure` element.
```js
const catsImg = document.querySelectorAll('figure > img')[1];
assert(
catsImg &&
catsImg.getAttribute('src').toLowerCase() === 'https://bit.ly/fcc-cats'
);
```
The Cats `img` element should have an `alt` attribute with the value `Five cats looking around a field.`
```js
const catsImg = document.querySelectorAll('figure > img')[1];
assert(
catsImg
.getAttribute('alt')
.replace(/\s+/g, ' ')
.match(/^Five cats looking around a field\.?$/i)
);
```
# --seed--
## --seed-contents--
```html
<html>
<body>
<h1>CatPhotoApp</h1>
<main>
<section>
<h2>Cat Photos</h2>
<!-- TODO: Add link to cat photos -->
<p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
<a href="https://freecatphotoapp.com"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
</section>
<section>
<h2>Cat Lists</h2>
<h3>Things cats love:</h3>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<figure>
<img src="https://bit.ly/fcc-lasagna" alt="A slice of lasagna on a plate.">
<figcaption>Cats <em>love</em> lasagna.</figcaption>
</figure>
<h3>Top 3 things cats hate:</h3>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
<figure>
--fcc-editable-region--
<img src="https://bit.ly/fcc-cats">
--fcc-editable-region--
</figure>
</section>
</main>
</body>
</html>
```