icon
元素是所有类型图标字体的一个容器。由于图标可能需要几秒钟延迟加载,所以您可能想要预留出图标所占的空间,那么您就可以使用 icon
类作为一个方形容器防止页面加载时被“忽略”掉。
默认 icon
容器会占用大约 1.5rem x 1.5rem
空间。图标本身型号跟您使用的图标库有关。例如,Font Awesome 5 图标会继承字体型号。
Icon 文字 #
您可以组合 icon
和 text,用 icon-text
包裹,只需将所有文字包裹在其自己的 span
元素 内:
示例
HTML
您可以随意组合任意数量的 icon
元素和文本元素:
示例
HTML
由于 icon-text
是一个 inline-flex
元素,所以它很容易插入段落内文本中。
示例
An invitation to dinner was soon afterwards dispatched; and already had Mrs. Bennet planned the courses that were to do credit to her housekeeping, when an answer arrived which deferred it all. Mr. Bingley was obliged to be in town the following day, and, consequently, unable to accept the honour of their invitation , etc.
Mrs. Bennet was quite disconcerted. She could not imagine what business he could have in town so soon after his arrival in Hertfordshire; and she began to fear that he might be always flying about from one place to another, and never settled at Netherfield as he ought to be.
HTML
您也可以通过使用 <div>
标记将 icon-text
变为 flex
元素:
示例
Your package will be delivered on Tuesday at 08:00.
Your image has been successfully uploaded.
Some information is missing from your profile details.
There was an error in your submission. Please try again.
HTML
颜色 #
由于图标字体就是简单的文字,所以您可以使用颜色辅助(Color Helper)修改图标颜色。
示例
HTML
同样适用 icon-text
:
示例
HTML
型号 #
Bulma 的 icon
容器有 4 种型号。通常它会稍大于图标。例如,Font Awesome 5 图标默认使用 1em
字体型号(由于其集成字体型号),但是也提供了补充字体型号。
Container class | Container size | Font Awesome 5 class | Icon size | Result |
---|---|---|---|---|
icon is-small
|
1rem x 1rem
|
fas
|
1em
|
|
icon
|
1.5rem x 1.5rem
|
fas
|
1em
|
|
fas fa-lg
|
1.33em
|
|||
icon is-medium
|
2rem x 2rem
|
fas
|
1em
|
|
fas fa-lg
|
1.33em
|
|||
fas fa-2x
|
2em
|
|||
icon is-large
|
3rem x 3rem
|
fas
|
1em
|
|
fas fa-lg
|
1.33em
|
|||
fas fa-2x
|
2em
|
Font Awesome 的各种变体 #
Font Awesome 也提供了修饰符类:
- 定宽图标
- 边框图标
- 动画图标
- 堆叠图标
类型 | Font Awesome 类 | 结果 |
---|---|---|
定宽 |
fas fa-fw
|
|
边框 |
fas fa-border
|
|
动画 |
fas fa-spinner fa-pulse
|
|
堆叠 | ||
Material Design 图标 #
这是 icon
容器如何用于 Material Design 图标。
Container class | Container size | MDI class | Icon size | Result |
---|---|---|---|---|
icon is-small
|
1rem x 1rem
|
mdi
|
1em
|
|
icon
|
1.5rem x 1.5rem
|
mdi mdi-18px
|
18px
|
|
mdi mdi-24px
|
24px
|
|||
icon is-medium
|
2rem x 2rem
|
mdi
|
1em
|
|
mdi mdi-18px
|
18px
|
|||
mdi mdi-24px
|
24px
|
|||
mdi mdi-36px
|
36px
|
|||
icon is-large
|
3rem x 3rem
|
mdi
|
1em
|
|
mdi mdi-18px
|
18px
|
|||
mdi mdi-24px
|
24px
|
|||
mdi mdi-36px
|
36px
|
|||
mdi mdi-48px
|
48px
|
MDI 也提供修饰符类:
- 亮色和暗色
- 旋转 & 反转图标
类型 | Material Design Icon 类 | 结果 |
---|---|---|
Light color |
mdi mdi-light
|
|
Dark color |
mdi mdi-dark
|
|
Light inactive color |
mdi mdi-light mdi-inactive
|
|
Dark inactive color |
mdi mdi-dark mdi-inactive
|
|
Flipped |
mdi mdi-flip-h
mdi mdi-flip-v
|
|
Rotated |
mdi mdi-rotate-45
mdi mdi-rotate-90
mdi mdi-rotate-180
|
|
Ionicons #
这是 icon
容器如何用于 Ionicons。
Container class | Container size | Ionicon class | Icon size | Result |
---|---|---|---|---|
icon is-small
|
1rem x 1rem
|
ion-ionic
|
1em
|
|
icon
|
1.5rem x 1.5rem
|
ion-ionic
|
1em
|
|
icon is-medium
|
2rem x 2rem
|
ion-ionic
|
1em
|
|
icon is-large
|
3rem x 3rem
|
ion-ionic
|
1em
|
此页面为开放源码页面。
发现排版问题?或者表达模糊?
在 GitHub 改进该页内容