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

效果图

相关推荐
小霸王_300378637 天前
《Google 与 Edge 浏览器对HTTP到HTTPS重定向处理的差异》
http·google·https·edge
hudawei99612 天前
google.mlkit:face-detection和 opencv的人脸识别有什么区别
人工智能·opencv·计算机视觉·google·人脸识别·mlkit·face-detection
Coffeeee12 天前
了解一下Android16更新事项,拿捏下一波适配
android·前端·google
前端切图仔00113 天前
Chrome 扩展程序上架指南
android·java·javascript·google
甲维斯13 天前
谷歌Antigravity 也支持技能了!
google
崔庆才丨静觅13 天前
Veo API:0 门槛量产商业级视频!2026 视频流量密码,创作者/商家必藏
后端·google·api
Dontla14 天前
onlineconvertfree.com (convert images to icons)
icon
小溪彼岸16 天前
Gemini CLI V0.22发布了Conductor和Endor Labs并向Free Tier用户开放了Gemini 3
google·gemini
崔庆才丨静觅19 天前
Veo API:0门槛量产商业级视频!2026视频流量密码,创作者/商家必藏
google·api
TTGGGFF1 个月前
解决Gemini无法进入显示 “Google Al Studio 和 Gemini AP| 的可用区域” 的问题
ai·google·gemini3