在前端项目中引用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,[email protected],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
} 

效果图

相关推荐
程序员爱钓鱼2 天前
Go 并发编程基础:通道(Channel)的使用
后端·google·go
laughing9984 天前
独立域名,免费服务器,无限活跃工作流--n8n免费部署
google·产品·工作流引擎
程序员爱钓鱼5 天前
Go Modules 详解 -《Go语言实战指南》
后端·google·go
程序员爱钓鱼6 天前
Go语言包的组织与导入 -《Go语言实战指南》
后端·google·go
众乐 认证6 天前
Google car key:安全、便捷的汽车解锁新选择
google·谷歌·carkey
程序员爱钓鱼7 天前
Go语言常见接口设计技巧-《Go语言实战指南》
后端·google·go
AI工具导航站17 天前
Google精准狙击OpenAI Codex,发布AI编程助手Jules!
google·ai编程
shandianchengzi1 个月前
【记录】Google|下载 Google 谷歌商店中的应用的多种方式
android·google·安卓·apk
Think_20131 个月前
今日分享:互联网巨头Google分析
人工智能·google·数据分析·股票
几米哥1 个月前
消费级GPU的AI逆袭:Gemma 3 QAT模型完整部署与应用指南
google·llm·gpu