So how is this icon effect achieved? Actually, it's just about introducing an icon font. This article teaches you how to add icons to WordPress or otherMethods for adding icons to website program menus or any location。Icon Font Introduction
Icon fonts, literally understood, are themselves font files, but they consist of icons. When designing mobile apps or web pages, the use of icons is often encountered. In early web design, icon image files were used, but due to different resolutions, icons could become blurry. Therefore, the application of using icon fonts to replace icon images later emerged. There are many types of icon fonts, some paid and some free. This article introduces two widely used icon fonts: iconfont and Font Awesome.How to Use iconfont Icon Fonts
Iconfont is a vector icon library created by Alibaba, providing functions such as vector icon downloads, online storage, and format conversion. It is powerful, rich in icons, and as a domestic platform, it offers fast network speeds.Visit iconfont Steps to use Iconfont:- Visit the website and log in at the top right corner.
- Select the icons you like and click the shopping cart button to add them to your collection.
- Click the shopping cart button at the top right corner and add them to a project.
- Create a project name and confirm.
- Copy the code and add it to your website's CSS file.
- Use the li tag in the frontend to reference the icons.
/* 定义class */ .iconfont{ font-family:"iconfont" !important; font-style:normal; -webkit-font-smoothing: antialiased; -webkit-text-stroke-width: 0.2px; -moz-osx-font-smoothing: grayscale; }Next, go back to where you want to display the icon, such as a menu, and add an i tag in the navigation label to call the icon.
<i class="iconfont">图标代码</i>
Naiba Tip:You can also add the Font class content to your theme's header.php file; choose either this method or the one above. The code is as follows:
<link rel='stylesheet' href='你的iconfont Font class代码' type='text/css' media='all' />
How to Use Font Awesome Icon Fonts
There are several websites for Font Awesome. Here, taking http://fontawesome.dashgame.com/ as an example, the usage is as follows: Add the following code to your theme's header.php (or the header code of other webpages):<link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">Then similarly, use the i tag to call the icon.
<i class="fa fa-camera-retro"></i> fa-camera-retroFor more usage methods, you canrefer to the official website
WordPress Plugin Method
If you are not familiar with adding webpage code, you can also directly useWordPress Pluginmethods to achieve it, as long as your server performance is good, don't worry about installing many plugins.
For example, install Font AwesomeDownload LinkAfter installation and activation, you can set the display method in the settings, whether to display as webfont or as SVG icons. When using, similarly use the i tag to call:<i class="fas fa-stroopwafel"></i>Additionally, the plugin also supports shortcode calls:
[icon name="stroopwafel"]

Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.