--- id: bad87fee1348bd9aedf08816 title: Link to External Pages with Anchor Elements challengeType: 0 videoUrl: '' localeTitle: 链接到具有锚元素的外部页面 --- ## Description
您可以使用anchor元素链接到网页外部的内容。 anchor元素需要一个名为href属性的目标Web地址。他们还需要锚文本。这是一个例子: <a href="https://freecodecamp.org">this links to freecodecamp.org</a>然后你的浏览器会显示文本“这个链接到freecodecamp.org”作为你可以点击的链接。该链接将带您到网址https://www.freecodecamp.org
## Instructions
创建一个链接到http://freecatphotoapp.com a元素,并将“猫照片”作为其anchor text
## Tests
```yml tests: - text: 你a元素应该有“猫照片”的anchor text 。 testString: 'assert((/cat photos/gi).test($("a").text()), "Your a element should have the anchor text of "cat photos".");' - text: '你需要一个链接到http://freecatphotoapp .com a元素' testString: 'assert(/http:\/\/(www\.)?freecatphotoapp\.com/gi.test($("a").attr("href")), "You need an a element that links to http://freecatphotoapp.com");' - text: 确保您a元素具有结束标记。 testString: 'assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/a element has a closing tag.");' ```
## Challenge Seed
```html

CatPhotoApp

A cute orange cat lying on its back.

Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.

Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.

```
## Solution
```js // solution required ```