Using Material-Design Icons in Web Pages
What Are Material Design Icons You've all heard of MD, right? It's Google's Material Design. Material Design icons are icons that conform to the MD design language. This article shows how to display Material Design icons on web pages using fonts. What are material icons Material design system icons are simple, modern, friend
目录7 个章节
What Are Material Design Icons
You've all heard of MD, right? It's Google's Material Design. Material Design icons are icons that conform to
the MD design language.
This article shows how to display Material Design icons on web pages using fonts.
What are material icons
Material design system icons are simple, modern, friendly, and sometimes quirky. Each icon is created using our design guidelines to depict in simple and minimal forms the universal concepts used commonly throughout a UI. Ensuring readability and clarity at both large and small sizes, these icons have been optimized for beautiful display on all common platforms and display resolutions.
See the full set of material design icons in the Material Icons Library.
Preparation
1. Using Google's Online Fonts
This is the most convenient way:
Include the online CSS file
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
2. Using Local Fonts
For reasons you understand, Google services cannot be used in mainland China, so we can download these fonts and then reference them in the web page.
Download link: https://github.com/google/material-design-icons/tree/master/iconfont
Create a new CSS file:
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://example.com/MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(https://example.com/MaterialIcons-Regular.woff2) format('woff2'),
url(https://example.com/MaterialIcons-Regular.woff) format('woff'),
url(https://example.com/MaterialIcons-Regular.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}
Using Them in Web Pages
Find the icon you want in the Material Design icon library, then you can display the icon correctly on the web page by its name.
Icon library: https://material.io/tools/icons/
Usage example:
<i class="material-icons">face</i>

Welcome to Discuss
For questions, please leave a message in the WeChat official account backend. I'll reply to every message~
- WeChat official account: 画星星高手
- Coding livestream: https://live.bilibili.com/11883038
- Zhihu: https://www.zhihu.com/people/dealiaxy
- Column: https://zhuanlan.zhihu.com/deali
- Jianshu: https://www.jianshu.com/u/965b95853b9f
_EOF_
Using Material-Design Icons in Web Pages
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
前端邪修:不用Vite也不用Webpack,把React拖回HTML时代的反工程化实践
反工程化React实践?直接HTML引入React写界面?这操作够“邪修”吧。工具链?HMR?不需要,手动加载依赖,浏览器缓存自己控。简单交互页面何必引入整套工程体系?这取舍,够“高冷”。
2025-12-30 · Web前端 · 约 1 分钟
视频中台解决方案:组织树组件+多路视频直播界面开发
这种国产粗犷风格的项目居然能用?16路视频播放界面倒是简单直接,但现场配置和设备管理流程真是够折腾的。WVP和mpegts.js?B站开源的尿性,细节全靠蒙。
2025-07-04 · Web前端 · 约 1 分钟
使用微软官方的IE虚拟机测试上古网站
下载地址:https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ 虚拟机默认密码:Passw0rd!
2021-12-18 · Web前端 · 约 1 分钟
代码使我头疼之React初学习
前言 开始了,去年(2020)说要学的React,到现在2021年的12月底了,才来实施……(年底警告!~~年末总结还没开始写!~~) 不过前端为啥要学React呢?Vue不是很好用吗?Vue确实很好用,并且MVVM模式也更容易让人接受和理解,但大概是各种社区上都说react yyds啦,react一统江山啦什么的,加上我之前学Flutter做了很多项目,对声明式UI的思想已经基本掌握了,所以就想
2021-12-26 · Web前端 · 约 1 分钟
讨论
共 0 条加载评论中…