5.1 KiB
5.1 KiB
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
bad87fee1348bd9aede08817 | Nest an Anchor Element within a Paragraph | 0 | Aninhar um elemento âncora dentro de um parágrafo |
Description
<p>Vamos detalhar o exemplo: o texto normal é encapsulado no elemento
Aqui está um <a target="_blank" href="http://freecodecamp.org"> link para freecodecamp.org </a> para você seguir.
</ p>
p
: <p> Here's a ... for you to follow. </p>
Em seguida, o elemento anchor
<a>
(que requer uma tag de fechamento </a>
): <a> ... </a>
target
é um atributo de marca de âncora que especifica onde abrir o link e o valor "_blank"
especifica para abrir o link em uma nova guia href
é um atributo de marca de âncora que contém o endereço de URL de a ligação: <a href="http://freecodecamp.org"> ... </a>
O texto "link para freecodecamp.org" , dentro do elemento anchor text
chamado anchor text
, exibirá um link para clicar: <a href=" ... ">link to freecodecamp.org</a>
A saída final do exemplo ficará assim: Aqui está um link para freecodecamp.org para você seguir.
Instructions
a
elemento dentro de um novo p
elemento (logo após a existente main
elemento). O novo parágrafo deve ter o texto "Visualizar mais fotos de gatos", em que "fotos de gatos" é um link, e o restante do texto é texto simples. Tests
tests:
- text: 'Você precisa de <code>a</code> elemento que vincule a "http://freecatphotoapp.com".'
testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").length > 0 || $("a[href=\"http://www.freecatphotoapp.com\"]").length > 0), "You need an <code>a</code> element that links to "http://freecatphotoapp.com".");'
- text: Sua <code>a</code> elemento deve ter o texto âncora de "fotos do gato"
testString: 'assert($("a").text().match(/cat\sphotos/gi), "Your <code>a</code> element should have the anchor text of "cat photos"");'
- text: Criar um novo <code>p</code> elemento em torno de seu <code>a</code> elemento. Deve haver pelo menos três tags <code>p</code> no seu código HTML.
testString: 'assert($("p") && $("p").length > 2, "Create a new <code>p</code> element around your <code>a</code> element. There should be at least 3 total <code>p</code> tags in your HTML code.");'
- text: Seu <code>a</code> elemento deve ser aninhado em seu novo elemento <code>p</code> .
testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().is("p") || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().is("p")), "Your <code>a</code> element should be nested within your new <code>p</code> element.");'
- text: Seu elemento <code>p</code> deve ter o texto "Ver mais" (com um espaço após ele).
testString: 'assert(($("a[href=\"http://freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi) || $("a[href=\"http://www.freecatphotoapp.com\"]").parent().text().match(/View\smore\s/gi)), "Your <code>p</code> element should have the text "View more " (with a space after it).");'
- text: Sua <code>a</code> elemento <em>não</em> deve ter o texto "Ver mais".
testString: 'assert(!$("a").text().match(/View\smore/gi), "Your <code>a</code> element should <em>not</em> have the text "View more".");'
- text: Certifique-se de que cada um dos seus elementos <code>p</code> tenha uma tag de fechamento.
testString: 'assert(code.match(/<\/p>/g) && code.match(/<p/g) && code.match(/<\/p>/g).length === code.match(/<p/g).length, "Make sure each of your <code>p</code> elements has a closing tag.");'
- text: Certifique-se de cada um de seus <code>a</code> elementos tem uma marca de fechamento.
testString: 'assert(code.match(/<\/a>/g) && code.match(/<a/g) && code.match(/<\/a>/g).length === code.match(/<a/g).length, "Make sure each of your <code>a</code> elements has a closing tag.");'
Challenge Seed
<h2>CatPhotoApp</h2>
<main>
<a href="http://freecatphotoapp.com" target="_blank">cat photos</a>
<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