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

效果图

相关推荐
寒水馨5 天前
Linux下载、安装protobuf-v35.1(附安装包protoc-35.1-linux-x86_64.zip)
linux·运维·服务器·google·序列化·protobuf·protoc
寒水馨5 天前
macOS下载、安装protobuf-v35.1(附安装包protoc-35.1-osx-universal_binary.zip)
macos·google·grpc·序列化·protobuf·protoc·数据交换
元Y亨H5 天前
大模型技术 模型调用结果解析 概述
google·langchain·llm
小鹿软件办公7 天前
谷歌 Lyria 3.5 正式上线:全面提升 AI 音乐表现力与创作控制
人工智能·google·lyria 3.5
Coffeeee10 天前
谷歌的一个优化建议,让我重新学了一遍Android里面如何正确处理位图
android·google·kotlin
码哥字节13 天前
Google 上周推了个 agents-cli,我装完发现 Claude Code 多了 7 个超能力
google·agent·claude
Mac的实验室19 天前
最新注册谷歌邮箱遇到此号码验证次数过多提示 | 谷歌账号电话号码用太多次的解决办法
google
众少成多积小致巨22 天前
Android C++ 编码规范指南
android·c++·google
小李@Free2FA23 天前
Google Cloud(GCP)二次验证怎么开?Cloud Identity 的 MFA 配置
google·gcp·mfa·账号安全
Mac的实验室1 个月前
2026年最新谷歌账号登陆和修改密码教程分享
google