--- id: bad87fee1348bd9aedd08845 title: Aggiungere le icone Font Awesome ai bottoni challengeType: 0 forumTopicId: 16638 required: - link: 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' raw: true dashedName: add-font-awesome-icons-to-our-buttons --- # --description-- Font Awesome è una comoda libreria di icone. Queste icone possono essere font web o grafica vettoriale. Queste icone sono trattate proprio come i caratteri. Puoi specificare la loro dimensione usando i pixel, e assumeranno la dimensione del carattere degli elementi HTML genitori. Puoi includere Font Awesome in qualsiasi app aggiungendo il seguente codice alla parte superiore del tuo HTML: ```html ``` In questo caso, lo abbiamo già aggiunto per te a questa pagina dietro le quinte. L'elemento `i` era originariamente utilizzato per rendere corsivi altri elementi, ma ora è comunemente usato per le icone. Puoi aggiungere le classi Font Awesome all'elemento `i` per trasformarlo in un'icona, ad esempio: ```html ``` Nota che anche l'elemento `span` è accettabile per l'uso con le icone. # --instructions-- Usa Font Awesome per aggiungere un'icona `thumbs-up` al tuo pulsante like inserendo un elemento `i` con le classi `fas` e `fa-thumbs-up`. Assicurati di mantenere il testo `Like` accanto all'icona. # --hints-- Dovresti aggiungere un elemento `i` con le classi `fas` e `fa-thumbs-up`. ```js assert($('i').is('.fas.fa-thumbs-up') || $('span').is('.fas.fa-thumbs-up')); ``` L'icona `fa-thumbs-up` dovrebbe essere posizionata all'interno del pulsante Like. ```js assert( ($('i.fa-thumbs-up').parent().text().match(/Like/gi) && $('.btn-primary > i').is('.fas.fa-thumbs-up')) || ($('span.fa-thumbs-up').parent().text().match(/Like/gi) && $('.btn-primary > span').is('.fas.fa-thumbs-up')) ); ``` Il tuo elemento `i` dovrebbe essere annidato all'interno dell'elemento `button`. ```js assert( $('button').children('i').length > 0 || $('button').children('span').length > 0 ); ``` Il tuo elemento icon dovrebbe avere un tag di chiusura. ```js assert(code.match(/<\/i>|<\/span>/g)); ``` # --seed-- ## --seed-contents-- ```html

CatPhotoApp

A cute orange cat lying on its back.
Three kittens running towards the camera.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
``` # --solutions-- ```html

CatPhotoApp

A cute orange cat lying on its back.
Three kittens running towards the camera.

Things cats love:

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
```