在前端项目中引用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 小时前
主流 AI IDE 之一的 Google Antigravity IDE 介绍
ide·人工智能·google·antigravity
1 天前
使用 svgfmt 优化 SVG 图标
前端·svg·icon
不老刘2 天前
新一代图像生成工具:Nano Banana Pro 带来更自然的创作体验
人工智能·google·gemini·nano banana pro
请叫我啊腻4 天前
全网都在找的Nano Banana Pro API 来了!便宜稳定0.15/张
google·ai大模型·nanobanana·aiapi·nanobananapro·gemini3.
AskHarries5 天前
RevenueCat 接入 Google Play 订阅全流程详解(2025 最新)
android·flutter·google
北极的树6 天前
Gemini 3.0发布,但Generative UI更让我眼前一亮
google·gemini
win4r6 天前
🚀开发者必看!深度测评谷歌Gemini 3 Pro + Antigravity IDE!对比Claude Sonnet 4.5前端编程巅峰对决!模型能力是否被
google·aigc·gemini
coder_pig6 天前
【AI省流快讯】Cloudflare 炸了 / Gemini 3 来了 / Antigravity 独家实测 (附:无法登录解法)
google·ai编程·gemini
std78797 天前
谷歌推“Cameyo”方案,助力企业从Win系统转型ChromeOS
google
前端小书生9 天前
Google Map、Solar Api
前端·react.js·google