在前端项目中引用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
} 

效果图

相关推荐
x-cmd2 天前
[x-cmd] Gemma 3 家族新成员:T5Gemma 2 正式发布,重新定义紧凑型编解码模型的性能上限
5g·google·x-cmd·gemma
x-cmd3 天前
[x-cmd] 性能与成本的帕累托前沿:Google 发布 Gemini 3 Flash,如何用“闪电速度”构建下一代 AI 应用?
大数据·人工智能·google·flash·gemini·x-cmd
Minilinux201811 天前
Google ProtoBuf 简介
开发语言·google·protobuf·protobuf介绍
li913618 天前
不限速!5款磁力下载工具,50M/s!(附磁力搜索软件合集)
google
小霸王_300378631 个月前
《Google 与 Edge 浏览器对HTTP到HTTPS重定向处理的差异》
http·google·https·edge
hudawei9961 个月前
google.mlkit:face-detection和 opencv的人脸识别有什么区别
人工智能·opencv·计算机视觉·google·人脸识别·mlkit·face-detection
Coffeeee1 个月前
了解一下Android16更新事项,拿捏下一波适配
android·前端·google
前端切图仔0011 个月前
Chrome 扩展程序上架指南
android·java·javascript·google
甲维斯1 个月前
谷歌Antigravity 也支持技能了!
google
崔庆才丨静觅1 个月前
Veo API:0 门槛量产商业级视频!2026 视频流量密码,创作者/商家必藏
后端·google·api