昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期四, 七月 19, 2018

[网站建设]Add or update font-awesome for wordpress theme

I am using a wordpress theme which uses an old version of font-awesome. And I noticed that the font-awesome style are embed in the main style.css file. I cannot upgrade font-awesome separately. 

The fontawesome-webfont.svg file is seperate and has version number 1.0. 

figure 1


To make use of the new version of font-awesome. I don't need to touch the old version. All I need to do is adding the following style into my theme.

figure 2


To add the new 5.1.1 fontawesome to your theme is easy.

Add this code into the  header.php of your theme between <head> and </head>


[html]
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.1/css/all.css" integrity="sha384-O8whS3fhG2OnA5Kas0Y9l3cfpmYjapjI0E4theH4iuMD+pLhbf6JI0jIMfYcK3yZ" crossorigin="anonymous">
[/html]

figure 3



Then you can start using the latest font-awesome icons. Try this <i class="fab fa-youtube"></i> in your posts, you can also use font-awesome in your menu text.

figure 4

figure 5



By adding a new style sheet will certainly impact your website's performance, because browsers has one more style sheet to load before rendering. But this method will not impact much for the server load as the font-awesome style is hosted by font-awesome CDN.





没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.