--- id: bad87fee1348bd9aede08817 title: Inserir um elemento de âncora em um parágrafo challengeType: 0 forumTopicId: 18244 dashedName: nest-an-anchor-element-within-a-paragraph --- # --description-- Você pode incluir links dentro de outros elementos de texto. ```html

Here's a link to www.freecodecamp.org for you to follow.

``` Vamos dividir o exemplo em partes. O texto normal está dentro do elemento `p`: ```html

Here's a ... for you to follow.

``` Em seguida, temos o elemento de *âncora* `` (que exige uma tag de fechamento ``): ```html ... ``` `target` é um atributo da tag de âncora que especifica onde abrir o link. O valor `_blank` especifica que o link deve ser aberto em uma nova aba. O atributo `href` da tag de âncora contém o endereço URL do link: ```html ... ``` O texto, `link to www.freecodecamp.org`, dentro do elemento `a`, é chamado de texto âncora e exibirá o link que pode ser clicado: ```html link to freecodecamp.org ``` O resultado final do exemplo ficará assim: Here's a link to www.freecodecamp.org for you to follow. # --instructions-- Insira o elemento `a` dentro de um novo elemento `p`. O novo parágrafo deve ter um texto que diz `View more cat photos`, onde `cat photos` é um link, enquanto o restante é texto sem formatação. # --hints-- Você deve ter apenas um elemento `a`. ```js assert( $('a').length === 1 ); ``` O elemento `a` deve direcionar para "`https://www.freecatphotoapp.com`". ```js assert( $('a[href="https://www.freecatphotoapp.com"]').length === 1 ); ``` O texto âncora do elemento `a` deve ser `cat photos` ```js assert( $('a') .text() .match(/cat\sphotos/gi) ); ``` Você deve criar um novo elemento `p`. Deve haver pelo menos 3 tags `p` no seu código HTML. ```js assert($('p') && $('p').length > 2); ``` O elemento `a` deve ser incluído em seu novo elemento `p`. ```js assert( $('a[href="https://www.freecatphotoapp.com"]').parent().is('p') ); ``` O elemento `p` deve ter o texto `View more` (com um espaço depois dele). ```js assert( $('a[href="https://www.freecatphotoapp.com"]') .parent() .text() .match(/View\smore\s/gi) ); ``` O elemento `a` não deve conter o texto `View more`. ```js assert( !$('a') .text() .match(/View\smore/gi) ); ``` Todos os elementos `p` devem ter uma tag de fechamento. ```js assert( code.match(/<\/p>/g) && code.match(/

/g).length === code.match(/

/g) && code.match(//g).length === code.match(/CatPhotoApp

cat photos 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.

``` # --solutions-- ```html

CatPhotoApp

View more cat photos

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.

```