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 otherwebsite program menus or any location.。Icon Font Introduction
Icon fonts, literally understood, are themselves font files, but they are fonts of icons. When designing mobile apps or web pages, the use of icons is often encountered. The earliest web designs used icon image files, but due to different resolutions, icons could become blurry. Therefore, the use of 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 being a domestic platform, it offers fast network speeds.Visit iconfont Iconfont Usage Steps:- Visit the website and log in at the top right.
- 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 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 on the frontend to reference the icon.
/* 定义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 the menu, and add an i tag in the navigation label to call the icon.
class="iconfont">图标代码 Naiba's Tip:You can also add the Font class content to your theme's header.php file. Choose one of the above methods. The code is as follows:
How to Use Font Awesome Icon Fonts
There are several websites for Font Awesome. Here, using http://fontawesome.dashgame.com/ as an example, the usage method is as follows: Add the following code in your theme's header.php (for other websites, add it in the webpage header code):Then, similarly use the i tag to call the icon.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 Pluginthe method to achieve it. As long as your server performance is good, don't be afraid of 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, also use the i tag to call: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.