curriculum/challenges/english/blocks/workshop-blog-page/669fd003cb89ee3c2402e041.md
In this introductory content, you will want to show an image of Mr. Whiskers with a caption.
Below the h1 element, start by adding a figure element.
Inside the figure element, add an img element.
The src attribute of the img should have a value of "https://cdn.freecodecamp.org/curriculum/css-photo-gallery/1.jpg" and the alt text should have a value of "a cat in the garden".
Below your img element, add a figcaption with the text Mr. Whiskers in the Garden.
Your figure element should have an opening tag.
assert.match(code, /<figure\>/);
Your figure element should have a closing tag.
assert.match(code, /<\/figure\>/);
Your figure element should be within your header element.
const figureElement = document.querySelector('figure');
assert.equal(figureElement?.parentElement.tagName, 'HEADER');
You should have an img element.
assert.exists(document.querySelector("img"));
Your img element should be within your figure element.
const imgElement = document.querySelector('img');
assert.strictEqual(imgElement?.parentElement.tagName, 'FIGURE');
Your img element should have a src attribute set to "https://cdn.freecodecamp.org/curriculum/css-photo-gallery/1.jpg".
const imgElement = document.querySelector('img');
const src = imgElement?.getAttribute('src');
assert.strictEqual(src, 'https://cdn.freecodecamp.org/curriculum/css-photo-gallery/1.jpg');
Your img element should have an alt attribute set to "a cat in the garden".
const imgElement = document.querySelector('img');
const alt = imgElement?.getAttribute('alt');
assert.strictEqual(alt, 'a cat in the garden');
Your figcaption element should have an opening tag.
assert.match(code, /<figcaption\>/);
Your figcaption element should have a closing tag.
assert.match(code, /<\/figcaption\>/);
Your figcaption element should be within your figure element.
const figcaptionElement = document.querySelector('figcaption');
assert.strictEqual(figcaptionElement?.parentElement.tagName, 'FIGURE');
Your figcaption element should have a the text of Mr. Whiskers in the Garden.
const figcaptionElement = document.querySelector('figcaption');
assert.strictEqual(figcaptionElement?.innerText.trim(), "Mr. Whiskers in the Garden")
Your figcaption should be below the img element. You have them in the wrong order.
const figureElement = document.querySelector('figure');
assert.strictEqual(figureElement?.lastElementChild?.tagName, "FIGCAPTION")
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mr. Whiskers' Blog</title>
<meta charset="UTF-8" />
</head>
<body>
<header>
<h1>Welcome to Mr. Whiskers' Blog Page!</h1>
--fcc-editable-region--
--fcc-editable-region--
</header>
</body>
</html>