* Update link-to-external-pages-with-anchor-elements.english.md If you write "`anchor` element" instead of "`a` element", you should also write "`hyperreference` attribute", instead of "`href` attribute". Suggestion: write "`a` (_anchor_) element", or "anchor (`a`) element", to communicate the element name explicitly and gloss it at the same time. The `<code>` sections should be valid code as far as possible. * Change md to html * Don't mark up 'anchor' as code The tag is `a`, the name is _anchor_. * Revert "Don't mark up 'anchor' as code" This reverts commit 50c6a3a7c9697f889489bd586ceccd617cc4af1c. * Don't mark up 'anchor' as code The tag is `a`, the name is _anchor_.
2.4 KiB
2.4 KiB
id, title, challengeType, videoUrl
id | title | challengeType | videoUrl |
---|---|---|---|
bad87fee1348bd9aedf08816 | Link to External Pages with Anchor Elements | 0 | https://scrimba.com/p/pVMPUv/c8EkncB |
Description
a
(anchor) elements to link to content outside of your web page.
a
elements need a destination web address called an href
attribute. They also need anchor text. Here's an example:
<a href="https://freecodecamp.org">this links to freecodecamp.org</a>
Then your browser will display the text "this links to freecodecamp.org" as a link you can click. And that link will take you to the web address https://www.freecodecamp.org.
Instructions
a
element that links to http://freecatphotoapp.com
and has "cat photos" as its anchor text
.
Tests
tests:
- text: Your <code>a</code> element should have the <code>anchor text</code> of "cat photos".
testString: assert((/cat photos/gi).test($("a").text()), 'Your <code>a</code> element should have the <code>anchor text</code> of "cat photos".');
- text: You need an <code>a</code> element that links to <code>http://freecatphotoapp<wbr>.com</code>
testString: assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")), 'You need an <code>a</code> element that links to <code>http://freecatphotoapp<wbr>.com</code>');
- text: Make sure your <code>a</code> element has a closing tag.
testString: assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, 'Make sure your <code>a</code> element has a closing tag.');
Challenge Seed
<h2>CatPhotoApp</h2>
<main>
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
<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>
Solution
// solution required