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

效果图

相关推荐
ArkAPI1 天前
腾讯AI基础设施的系统论:从推理框架的算子融合到智能体的任务分解
人工智能·ai·google·aigc·腾讯·多模态处理·arkapi
GPTMirrors镜像系统4 天前
谷歌Gemini"Something went wrong"错误解决方法:2步快速解除限制(2025最新教程)
google·gemini
后端小肥肠6 天前
谷歌Opal + Gemini 3 Pro 强强合体:手搓“AI漫剧生成器”只需 5 分钟!
google·aigc·gemini
坐吃山猪6 天前
A2UI快速入门
google·llm·a2ui
草帽lufei10 天前
用 Gemini3 Flash 做了多半天开发,我离下岗又近了一步
google·ai编程·gemini
感谢地心引力10 天前
【AI】免费的代价?Google AI Studio 使用指南与 Cherry Studio + MCP 实战教程
人工智能·ai·google·chatgpt·gemini·mcp·cherry studio
北极的树16 天前
Google ADK上下文工程:当AI Agent学会像编译器一样管理上下文
google·agent
云雾J视界18 天前
当算法试图解决一切:技术解决方案主义的诱惑与陷阱
算法·google·bert·transformer·attention·算法治理
程序员老刘19 天前
Flutter凉不了:它是Google年入3000亿美元的胶水
flutter·google·客户端
yaocheng的ai分身22 天前
Google的Antigravity AI删除了开发者的驱动器,然后道歉了
google·gemini