App下載

bootstrap圖標是什么?常用圖標有哪些?

深巷的貓 2021-04-27 11:22:36 瀏覽數(shù) (9813)
反饋

我們在開發(fā)一個網(wǎng)頁時,會經(jīng)常使用到一些圖標來增強頁面美觀。如果是自己重新設(shè)計圖標的話費時又費力,直接使用 bootstrap 框架內(nèi)的圖標會方便很多。那么你知道 bootstrap 圖標是什么?常用圖標有哪些?

bootstrap圖標是什么?

bootstrap 框架中的圖標是字體圖標,需要通過?@font-face?屬性加載字體。

@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}

字體自定義完之后,需要對?icon?進行樣式的設(shè)置。在 bootstrap 中給元素添加?glyphicon?類名,然后通過偽元素?:before?的?content?屬性調(diào)取相應的 icon 編碼。

.glyphicon {
  position: relative;
  top: 1px;
  display: inline-block;
  font-family: 'Glyphicons Halflings';
  -webkit-font-smoothing: antialiased;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  -moz-osx-font-smoothing: grayscale;
}

常用圖標有哪些?

bootstrap 的字體圖標高達兩百多種,各自對應相應的編碼。如下圖:

20170928160008922

20170928160018351

20170928160024961

20170928160031323

20170928160037889


具體圖標使用方法在往期文章《如何使用bootstrap圖標》一文中有進行詳細解說,請同學們自行回顧。

以上就是文章“bootstrap 圖標是什么?常用圖標有哪些?”的全部內(nèi)容。更多 bootstrap 的學習請關(guān)注 w3cschool 官網(wǎng)。

推薦課程:bootstrap3入門課程


0 人點贊