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

效果图

相关推荐
Coffeeee4 天前
从 Android 15 到 Android 17,谷歌猝不及防的音频改动
android·前端·google
云卷云舒___________4 天前
Google Gemini 3.5 Pro泄露、GPT-5.6套餐限额放宽、Meta Watermelon追平GPT-5.5 | 7月4日 AI日报
google·meta·openai·gemini·ai日报·gpt56·watermelon
武子康7 天前
调查研究-209 Apptronik Robot Park 深度解析:人形机器人竞争,开始拼“真实世界数据工厂“
人工智能·google·llm
Mac的实验室14 天前
最新注册谷歌Gmail邮箱遇到扫码无法验证的解决教程|2026年6月实测,Google邮箱注册不需要国内手机号发短信验证
google
Jack_num115 天前
AI 编程时代,UI 设计系统也需要工程化:从 Google DESIGN.md 说起
google·ai编程
winfredzhang24 天前
用 MediaPipe 手势数字识别一键打开下载夹里的图片(Python + OpenCV 实战)
人工智能·python·opencv·google·mediapipe
算家云1 个月前
极速并行文本生成:谷歌开源 DiffusionGemma 扩散大模型
ai·google·大模型·算力
HyperAI超神经1 个月前
在线教程丨最高4倍生成速度提升,DiffusionGemma可同时生成整块文本,基于多轮并行去噪持续优化结果
人工智能·google·长上下文
黄林晴1 个月前
Google Play 发版链路全面重构:合规前置、审核自动化、生态全面收紧
android·google