--- id: bad87fee1348bd9aedf08816 title: Collegare a pagine esterne con elementi di ancoraggio challengeType: 0 videoUrl: 'https://scrimba.com/p/pVMPUv/c8EkncB' forumTopicId: 18226 dashedName: link-to-external-pages-with-anchor-elements --- # --description-- Puoi usare elementi `a` (*anchor*) per creare dei collegamenti (link) a contenuti al di fuori della tua pagina web. Gli elementi `a` richiedono un indirizzo web di destinazione, inserito in un attributo `href`. Hanno bisogno anche di un testo di ancoraggio. Ecco un esempio: ```html this links to freecodecamp.org ``` A questo punto il tuo browser visualizzerĂ  il testo: `this links to freecodecamp.org` come link cliccabile. E quel link ti porterĂ  all'indirizzo web `https://www.freecodecamp.org`. # --instructions-- Crea un elemento `a` che si colleghi a `https://www.freecatphotoapp.com` e abbia "cat photos" come testo di ancoraggio. # --hints-- Il tuo elemento `a` dovrebbe avere il testo di ancoraggio: `cat photos`. ```js assert(/cat photos/gi.test($('a').text())); ``` Hai bisogno di un elemento `a` che si colleghi a `https://www.freecatphotoapp.com` ```js assert(/^https?:\/\/(www\.)?freecatphotoapp\.com\/?$/i.test($('a').attr('href'))); ``` Il tuo elemento `a` dovrebbe avere un tag di chiusura. ```js assert( code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(/CatPhotoApp
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

A cute orange cat lying on its back. cat photos

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.

```