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

效果图

相关推荐
spencer_tseng8 小时前
google chrome show virtual keyboard
chrome·google
人道领域1 天前
2026年Q1大模型深度复盘:OpenAI,Gemini2.0,字节跳动,与“多模态Agent”元年
人工智能·ai·google·chatgpt·gemini
用户69371750013842 天前
Room 3.0:这次不是升级,是重来
android·前端·google
码路飞4 天前
Gemini 开放香港了,大陆开发者的 API 能跟着薅吗?实测 3 种方案
google·api·gemini
Carson带你学Android6 天前
Android 17 重磅发布:详解四大颠覆性变革与保姆级适配指南
google
Qiuner6 天前
浏览器拓展通用安装方法 edge浏览器、谷歌浏览器、google浏览器、火狐浏览器
前端·google·edge
wing988 天前
Vue3 接入 Google 登录:极简教程
前端·vue.js·google
CocoaKier9 天前
苹果谷歌纷纷调低官方抽成,苹果谷歌全球抽成比例汇总
ios·google·apple
程序员爱钓鱼12 天前
Go并发控制核心:context 包完整技术解析
后端·google·go
程序员爱钓鱼13 天前
Go生成唯一ID的标准方案:github.com/google/uuid使用详解
后端·google·go