在前端项目中引用Google Icon实现各种图标的显示

Google Icon

Google 提供了常见Icon集合,方便用户使用。目前有两个版本,Version1支持形状,填充和圆角等供用户选择。

Version2的功能更加强大,在第一版的基础上,支持调节线条的粗细。

Google Icon Link

Version 1 的具体实践

Version 1 支持的类型

  • Material+Icons
  • Material+Icons+Outlined
  • Material+Icons+Round
  • Material+Icons+Sharp
  • Material+Icons+TwoTone

示例 1

在项目中引用Google Icon的链接

html 复制代码
<link
href="<https://fonts.googleapis.com/icon?family=Material+Icons>"
rel="stylesheet"
/>  

在angular的项目文件中使用Google Icon

html 复制代码
<mat-icon>warning</mat-icon>
<mat-icon>warning_amber</mat-icon>
<mat-icon>warning_amber_outlined</mat-icon>  

效果图

示例2

在项目中引用Google Icon的链接, Material+Icons+Round是圆角的集合

html 复制代码
<link  
href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round"
rel="stylesheet"
/>  

在angular的项目文件中使用Google Round Icon,注意 : 这里要引用material-icons-roundclass

html 复制代码
<mat-icon class="material-icons-round">warning</mat-icon>
<mat-icon class="material-icons-round">warning_amber</mat-icon>  

效果图

Version 2 的具体实践

Version 2 支持的类型

  • Material+Symbols
  • Material+Symbols+Rounded
  • Material+Symbols+Outlined
  • Material+Symbols+Sharp

示例 3

在项目中引用Google Icon Version2的链接

html 复制代码
<link  
href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200"  
rel="stylesheet"
/>  

在项目中引用Google Icon的链接

html 复制代码
<mat-icon class="material-symbols-rounded">warning</mat-icon>  

CSS 文件中自定义的设置

css 复制代码
.material-symbols-rounded {  
    font-variation-settings:   
        'FILL' 0,
        'wght' 300,
        'GRAD' 0,  
        'opsz' 24
} 

效果图

相关推荐
OpenBayes贝式计算12 分钟前
端侧同尺寸 SOTA:OpenBMB 发布 1B 参数模型 MiniCPM5-1B;集成多级平行语料与多语言词典:SMOL 翻译数据集开源
计算机视觉·google·nvidia
针叶21 小时前
Google Play加固保护导致的崩溃
android·安全·google
黄林晴1 天前
Google Play 全面进化:AI 驱动增长,从上架到收入全链路重构
android·google
叶落阁主1 天前
Vue3 中如何设计一套好用的 Icon 和 IconPicker 组件
前端·vue.js·icon
DogDaoDao5 天前
深入解析 libaom:AV1 开源编解码库技术分析
google·开源·音视频·视频编解码·hevc·av1·libaom
小鹿软件办公7 天前
Google ChromeOS 148 正式推送,为 150 长期支持版铺路
google·chromeos
曲幽7 天前
写页面时别再把 Element Plus 整个搬进来啦!Vue3按需加载的坑我帮你踩平了
vue3·web·vite·icon·element plus·vs code·import·unplugin
冬奇Lab8 天前
一天一个开源项目(第113篇):notebooklm-py - 把 Google NotebookLM 变成可编程 API,还能接入 Claude Code
人工智能·google·开源
Carson带你学Android10 天前
Google I/O 2026:Android 开发,Agent 时代来了
google·ai编程·google io
环信即时通讯云11 天前
AI圈今日大事(2026-05-21)
人工智能·阿里云·ai·google·芯片·qwen·gemini