This tutorial explains the use of iconfont in CSS in detail
First introduction to iconfont
Even if we don’t understand this English at first and don’t understand what it does, for iconfont, when read from back to front in English, it should be called: font icon. This already contains two concepts, first it must be the font, and second, it must be the icon. We all know that we can control the size, style, deformation, stretching, default font and other attributes of fonts on web pages, so this iconfont must be embedded in the style as text, so the font that comes to mind must be; since it is an icon, it must There is a path to introduce it. First of all, we first thought of the img tag. Since it is both text and icon, the only thing we can think of is the @font-facecss3 attribute.
There is also the later word iconfont, which did not appear at the beginning. It is a presentational layer given by web page producers or scholars who want to make it sound more pleasant.
So, when we see Alibaba’s iconfont icon tutorial as follows:
Step 1: Use font-face to declare the font
@font-face {font-family: 'iconfont';
src: url('iconfont .eot'); /* IE9*/
src: url('iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff') format ('woff'), /* chrome, firefox */
url('iconfont.ttf') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url(' iconfont.svg#uxiconfont') format('svg'); /* iOS 4.1- */
}
Step 2: Define the style using iconfont
.iconfont{
font-family:"iconfont" !important ;
font-size:16px;font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;}
Step 3: Select the corresponding icon and get the font encoding, apply it to the page
#x33
The effect is as follows
However, Iconfont has some disadvantages:
The browser treats it as text and resists With aliasing optimization, sometimes the results are not as sharp as expected. In particular, different anti-aliasing algorithms for text under different systems may lead to different display effects.
Icon Font As a font, the size and position of Icon display may be affected by font-size, line-height, word-spacing and other CSS properties. The CSS style of the container where the Icon is located may affect the position of the Icon, making it inconvenient to adjust.
There are inconveniences in use. First, loading an Icon Font that contains hundreds of icons but only using a few of them wastes loading time. It is also very inconvenient if you make your own Icon Font and integrate the icons used in multiple Icon Fonts into one Font. Of course, using the Alibaba UX vector icon library can solve this problem
In order to achieve maximum browser support, at least four different types of font files may be provided. Includes TTF, WOFF, EOT and a font defined using SVG format. If you make it yourself, you may have a headache
The above is the detailed explanation of the use of iconfont in CSS. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

In a perfect world, our projects would have unlimited resources and time. Our teams would begin coding with well thought out and highly refined UX designs.

Oh, the Many Ways to Make Triangular Breadcrumb Ribbons

SVG has its own set of elements, attributes and properties to the extent that inline SVG code can get long and complex. By leveraging CSS and some of the forthcoming features of the SVG 2 specification, we can reduce that code for cleaner markup.

You might not know this, but JavaScript has stealthily accumulated quite a number of observers in recent times, and Intersection Observer is a part of that

We may not need to throw out all CSS animations. Remember, it’s prefers-reduced-motion, not prefers-no-motion.

PWA (Progressive Web Apps) have been with us for some time now. Yet, each time I try explaining it to clients, the same question pops up: "Will my users be

It's extremely surprising to me that HTML has never had any way to include other HTML files within it. Nor does there seem to be anything on the horizon that

There are a lot of different ways to use SVG. Depending on which way, the tactic for recoloring that SVG in different states or conditions — :hover,


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools