73 lines
5.1 KiB
Markdown
73 lines
5.1 KiB
Markdown
|
---
|
||
|
id: bad87fee1348bd9aede08817
|
||
|
title: Nest an Anchor Element within a Paragraph
|
||
|
challengeType: 0
|
||
|
videoUrl: ''
|
||
|
localeTitle: Aninhar um elemento âncora dentro de um parágrafo
|
||
|
---
|
||
|
|
||
|
## Description
|
||
|
<section id="description"> Você pode aninhar links dentro de outros elementos de texto. <blockquote> <p> <br> Aqui está um <a target="_blank" href="http://freecodecamp.org"> link para freecodecamp.org </a> para você seguir. <br> </ p> </blockquote> Vamos detalhar o exemplo: o texto normal é encapsulado no elemento <code>p</code> : <br> <code><p> Here's a ... for you to follow. </p></code> Em seguida, o elemento <code>anchor</code> <code><a></code> (que requer uma tag de fechamento <code></a></code> ): <br> <code><a> ... </a></code> <code>target</code> é um atributo de marca de âncora que especifica onde abrir o link e o valor <code>"_blank"</code> especifica para abrir o link em uma nova guia <code>href</code> é um atributo de marca de âncora que contém o endereço de URL de a ligação: <br> <code><a href="http://freecodecamp.org"> ... </a></code> O texto <strong>"link para freecodecamp.org"</strong> , dentro do elemento <code>anchor text</code> chamado <code>anchor text</code> , exibirá um link para clicar: <br> <code><a href=" ... ">link to freecodecamp.org</a></code> A saída final do exemplo ficará assim: <br><p> Aqui está um <a target="_blank" href="http://freecodecamp.org">link para freecodecamp.org</a> para você seguir. </p></section>
|
||
|
|
||
|
## Instructions
|
||
|
<section id="instructions"> Agora ninho sua existente <code>a</code> elemento dentro de um novo <code>p</code> elemento (logo após a existente <code>main</code> 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. </section>
|
||
|
|
||
|
## Tests
|
||
|
<section id='tests'>
|
||
|
|
||
|
```yml
|
||
|
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.");'
|
||
|
|
||
|
```
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Challenge Seed
|
||
|
<section id='challengeSeed'>
|
||
|
|
||
|
<div id='html-seed'>
|
||
|
|
||
|
```html
|
||
|
<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>
|
||
|
|
||
|
```
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Solution
|
||
|
<section id='solution'>
|
||
|
|
||
|
```js
|
||
|
// solution required
|
||
|
```
|
||
|
</section>
|