https://material.io/
左側選單說明,每個符號有五個主題和一系列可下載的大小和密度。
右上有三個選項,分別是:icon設計原則、動畫的icon、icon主題
https://material.io/resources/icons/?style=baseline
【引用方式一】直接引用
在<head></head>之間放入
<link href=”https://fonts.googleapis.com/icon?family=Material+Icons” rel=”stylesheet”>
上圖的左邊,有5種樣式:
- Filled
- Outlined
- Rounded
- Two-Tone
- Sharp
每一種樣式就是一套字體,需要用到的話,則要各自引入
/* fallback */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}
/* fallback */
@font-face {
font-family: 'Material Icons Outlined';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialiconsoutlined/v13/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUce.woff2) format('woff2');
}
/* fallback */
@font-face {
font-family: 'Material Icons Round';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialiconsround/v13/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmP.woff2) format('woff2');
}
/* fallback */
@font-face {
font-family: 'Material Icons Sharp';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialiconssharp/v14/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvR.woff2) format('woff2');
}
/* fallback */
@font-face {
font-family: 'Material Icons Two Tone';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialiconstwotone/v12/hESh6WRmNCxEqUmNyh3JDeGxjVVyMg4tHGctNCu0.woff2) format('woff2')
}
.material-icons{ vertical-align: middle;}
.material-icons-outlined { vertical-align: middle;
font-family: 'Material Icons Outlined';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';}
在<body></body>之間直接寫入代碼 face<i class=”material-icons”>face</i> 因為是字型,所以可直接調整替代文字大小
關於圖形樣式適合的樣式有4種
/* Rules for sizing the icon. */
.material-icons.md-18 { font-size: 18px; }
.material-icons.md-24 { font-size: 24px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }
白色背景,normal
<i class="material-icons md-dark">face</i>
白色背景,Disabled
<i class="material-icons md-dark md-inactive">face</i>
深色背景,Normal
<i class="material-icons md-light">face</i>
深色背景,Disabled
<i class="material-icons md-light md-inactive">face</i>
/* Rules for using icons as black on a light background. */
.material-icons.md-dark { color: rgba(0, 0, 0, 0.54); }
.material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); }
/* Rules for using icons as white on a dark background. */
.material-icons.md-light { color: rgba(255, 255, 255, 1); }
.material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); }
--------------------------2020/09/01--------------------------------------------------------
前一陣子material-icon佛心的增加了大量新icon,但哀傷的是有時候把代碼貼上去,icon顯示不出來,或者只能在實心/空心....等,其中一種狀態出現。
不過今天使用測試發現,Google大神似乎把這個Bug修好了,現在不管是新舊icon都可以正常使用,引入的代碼我從每個字體都引入,改為減少成兩行
@import url(https://fonts.googleapis.com/icon?family=Material+Icons);
@import url(https://fonts.googleapis.com/icon?family=Material+Icons+Outlined);
測試結果,空心還是實心...等字體,都也可以正常顯示。
Google大神啊,沒有你我真的連廢柴都不是,真該為你立個長生牌位啊啊啊啊.........
沒有留言:
張貼留言