* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
59 lines
1.9 KiB
Markdown
59 lines
1.9 KiB
Markdown
---
|
|
id: bad87fee1348bd9aedf08817
|
|
title: '用 # 号来创建链接占位符'
|
|
challengeType: 0
|
|
videoUrl: 'https://scrimba.com/p/pVMPUv/cMdkytL'
|
|
forumTopicId: 18230
|
|
dashedName: make-dead-links-using-the-hash-symbol
|
|
---
|
|
|
|
# --description--
|
|
|
|
有时你想为网站添加一个 `a` 元素,但还不确定要将它链接到哪里。这时,你可以使用链接占位符。
|
|
|
|
链接占位符还有一个应用场景,就是实现在点击 `a` 元素时执行 `JavaScript` 代码。我们会在后面的课程中学到。
|
|
|
|
# --instructions--
|
|
|
|
目前,`href` 的属性值是 "`https://freecatphotoapp.com`"。请将 `href` 属性的值替换为`#`,以此来创建链接占位符。
|
|
|
|
例如: `href="#"`
|
|
|
|
# --hints--
|
|
|
|
`a` 的 `href` 属性值应为 "#"。
|
|
|
|
```js
|
|
assert($('a').attr('href') === '#');
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<h2>CatPhotoApp</h2>
|
|
<main>
|
|
<p>Click here to view more <a href="https://freecatphotoapp.com" target="_blank">cat photos</a>.</p>
|
|
|
|
<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>
|
|
<p>Click here to view more <a href="#" target="_blank">cat photos</a>.</p>
|
|
|
|
<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>
|
|
```
|