* chore(learn): audit files for crowdin Audits the challenge text in the Responsive Web Design superblock to account for words/phrases that should not be translated because they refer to code. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: remove quotes from code Removes instances of quoted code blocks, or code blocked quotes. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: additional uncaught quote-codes Thanks Oliver :) Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * fix: so many quotes Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> * fix: missing punctuation Noted in a Crowdin comment. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> * fix: remove more quotes Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
77 lines
2.2 KiB
Markdown
77 lines
2.2 KiB
Markdown
---
|
|
id: bad87fee1348bd9aedf08816
|
|
title: Link to External Pages with Anchor Elements
|
|
challengeType: 0
|
|
videoUrl: 'https://scrimba.com/p/pVMPUv/c8EkncB'
|
|
forumTopicId: 18226
|
|
dashedName: link-to-external-pages-with-anchor-elements
|
|
---
|
|
|
|
# --description--
|
|
|
|
You can use `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--
|
|
|
|
Create an `a` element that links to `https://freecatphotoapp.com` and has "cat photos" as its anchor text.
|
|
|
|
# --hints--
|
|
|
|
Your `a` element should have the anchor text of `cat photos`.
|
|
|
|
```js
|
|
assert(/cat photos/gi.test($('a').text()));
|
|
```
|
|
|
|
You need an `a` element that links to `https://freecatphotoapp.com`
|
|
|
|
```js
|
|
assert(/https:\/\/(www\.)?freecatphotoapp\.com/gi.test($('a').attr('href')));
|
|
```
|
|
|
|
Your `a` element should have a closing tag.
|
|
|
|
```js
|
|
assert(
|
|
code.match(/<\/a>/g) &&
|
|
code.match(/<\/a>/g).length === code.match(/<a/g).length
|
|
);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<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>
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```html
|
|
<h2>CatPhotoApp</h2>
|
|
<main>
|
|
|
|
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">
|
|
|
|
<a href="https://freecatphotoapp.com">cat photos</a>
|
|
<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>
|
|
```
|