2.5 KiB
2.5 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
bad87fee1348bd9aedf08816 | Link to External Pages with Anchor Elements | 0 | Enlace a páginas externas con elementos de anclaje |
Description
anchor
para vincular contenido fuera de su página web. anchor
elementos de anchor
necesitan una dirección web de destino denominada atributo href
. También necesitan texto de anclaje. Aquí hay un ejemplo: <a href="https://freecodecamp.org">this links to freecodecamp.org</a>
Luego, su navegador mostrará el texto "este enlace a freecodecamp.org" como un enlace en el que puede hacer clic. Y ese enlace lo llevará a la dirección web https://www.freecodecamp.org . Instructions
a
elemento que une a http://freecatphotoapp.com
y tiene "fotos del gato" como su anchor text
. Tests
tests:
- text: Su <code>a</code> elemento debe tener el <code>anchor text</code> de fotos "gato".
testString: 'assert((/cat photos/gi).test($("a").text()), "Your <code>a</code> element should have the <code>anchor text</code> of "cat photos".");'
- text: 'Es necesario un <code>a</code> elemento que une a <code>http://freecatphotoapp .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: Asegúrese de que su <code>a</code> elemento tiene una etiqueta de cierre.
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