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

效果图

相关推荐
winfredzhang3 天前
用 MediaPipe 手势数字识别一键打开下载夹里的图片(Python + OpenCV 实战)
人工智能·python·opencv·google·mediapipe
算家云5 天前
极速并行文本生成:谷歌开源 DiffusionGemma 扩散大模型
ai·google·大模型·算力
HyperAI超神经5 天前
在线教程丨最高4倍生成速度提升,DiffusionGemma可同时生成整块文本,基于多轮并行去噪持续优化结果
人工智能·google·长上下文
黄林晴7 天前
Google Play 发版链路全面重构:合规前置、审核自动化、生态全面收紧
android·google
OpenBayes贝式计算7 天前
LongCat-Video-Avatar 1.5开源,具备全领域泛化能力的音频驱动视频生成模型;AI Student Impact Dataset 5 万量级多
google·llm·agent
OpenBayes贝式计算7 天前
教程上新丨16GB 笔记本跑出接近 26B MoE 性能,Gemma 4 12B 基于创新架构统一处理文本 / 图像 / 声音三种模态
计算机视觉·google·agent
花间相见7 天前
【端侧AI模型】—— Google Gemma 4 全面解析:端侧大模型的新标杆
人工智能·google·ai编程·gemini
Coffeeee8 天前
准备升级到Android16,自适应布局应该如何适配
android·google·kotlin
若苗瞬10 天前
继续提速:Llama.cpp 已经正式支持 Gemma4 MTP
google·llama·gemma·qat·mtp