--- id: bad87fee1348bd9aedc08845 title: 将字体图标添加到所有的按钮上 challengeType: 0 forumTopicId: 16637 required: - link: 'https://use.fontawesome.com/releases/v5.8.1/css/all.css' raw: true dashedName: add-font-awesome-icons-to-all-of-our-buttons --- # --description-- Font Awesome 是一个非常便利的图标库。 这些图标可以是网络字体,也可以是一张矢量图。 这些图标就和字体一样, 不仅能通过像素单位指定它们的大小,它们也同样会继承父级 HTML 元素的字号。 # --instructions-- 为 info 按钮添加 Font Awesome `info-circle` 图标,delete 按钮添加 `trash` 图标。 **注意:** 下述要求中的 `i` 元素也可以用 `span` 元素代替。 # --hints-- 应在 `info` 按钮元素中添加一个 ``。 ```js assert( $('.btn-info > i').is('.fas.fa-info-circle') || $('.btn-info > span').is('.fas.fa-info-circle') ); ``` 应在 `delete` 按钮元素中添加一个 ``。 ```js assert( $('.btn-danger > i').is('.fas.fa-trash') || $('.btn-danger > span').is('.fas.fa-trash') ); ``` 每个 `i` 元素都应有一个闭合标签,`` 在 `like` 标签元素中。 ```js assert( code.match(/<\/i>|<\/span/g) && code.match(/<\/i|<\/span>/g).length > 2 && ($('.btn-primary > i').is('.fas.fa-thumbs-up') || $('.btn-primary > span').is('.fas.fa-thumbs-up')) ); ``` # --seed-- ## --seed-contents-- ```html
Things cats love:
Top 3 things cats hate: