--- id: bad87fee1348bd9aede08817 title: Вставте якірний елемент в Абзац challengeType: 0 forumTopicId: 18244 dashedName: nest-an-anchor-element-within-a-paragraph --- # --description-- Можна вкласти посилання в інші текстові елементи. ```html

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

``` Давайте зупинимося на прикладі. Звичайний текст поміщений в елемент:`p`: ```html

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

``` Далі йде *anchor* element `` (який вимагає кінцевого тегу ``): ```html ... ``` `target` це атрибут прив’язного тегу, який визначає, де відкрити посилання. Значення вказує на відкриття посилання в новій вкладці`_blank`. `href` є атрибутом прив’язки, який містить URL адресу посилання: ```html ... ``` Текст `link to www.freecodecamp.org`, усередині `a`елемента, який називається anchor text буде відображати посилання, на яке потрібно натиснути: ```html link to freecodecamp.org ``` Кінцевий результат прикладу буде виглядати наступним чином: Here's a link to www.freecodecamp.org for you to follow. # --instructions-- Вкласти існуючий `a`елемент в новий `p` елемент. Не створюйте нову мітку для прив'язки. У новому абзаці має бути текст із зазначенням `View more cat photos` де `cat photos` є посиланням, а решта - простим текстом. # --hints-- У вас має бути тільки один елемент `a`. ```js assert( $('a').length === 1 ); ``` Eлемент `a` повинен покликатись на `https://www.freecatphotoapp.com`". ```js assert( $('a[href="https://www.freecatphotoapp.com"]').length === 1 ); ``` Ваш `a` елемент повинен складатися з ідентифікатору `cat photos` ```js assert( $('a') .text() .match(/cat\sphotos/gi) ); ``` Ви повинні створити новий елемент `p`. У вашому HTML-коді повинно бути не менше трьох тегів.`p`. ```js assert($('p') && $('p').length > 2); ``` Ваш `a` елемент повинен бути вкладений в новий елемент `p`. ```js assert( $('a[href="https://www.freecatphotoapp.com"]').parent().is('p') ); ``` Елемент `p` повинен мати текст `View more` (з пропуском після нього). ```js assert( $('a[href="https://www.freecatphotoapp.com"]') .parent() .text() .match(/View\smore\s/gi) ); ``` Ваш елемент `a` not не повинен мати текст `View more`. ```js assert( !$('a') .text() .match(/View\smore/gi) ); ``` Кожен з `p` елементів повинен мати кінцевий тег. ```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.

```