中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Bootstrap 字體圖標

本章節(jié)將講解字體圖標(Glyphicons),并通過一些實例了解它的使用。Bootstrap 捆綁了 200 多種字體格式的字形。首先讓我們先來理解一下什么是字體圖標。


什么是字體圖標?

字體圖標是在 Web 項目中使用的圖標字體。雖然,Glyphicons Halflings 需要商業(yè)許可,但是您可以通過基于項目的 Bootstrap 來免費使用這些圖標。

為了表示對圖標作者的感謝,希望您在使用時加上 GLYPHICONS 網站的鏈接。


獲取字體圖標

我們已經在 環(huán)境安裝 章節(jié)下載了 Bootstrap 3.x 版本,并理解了它的目錄結構。在 fonts 文件夾內可以找到字體圖標,它包含了下列這些文件:

  • glyphicons-halflings-regular.eot
  • glyphicons-halflings-regular.svg
  • glyphicons-halflings-regular.ttf
  • glyphicons-halflings-regular.woff

相關的 CSS 規(guī)則寫在 dist 文件夾內的 css 文件夾內的 bootstrap.cssbootstrap-min.css 文件上。


CSS 規(guī)則解釋

下面的 CSS 規(guī)則構成 glyphicon class。

@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'); } .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; }

所以 font-face 規(guī)則實際上是在找到 glyphicons 地方聲明 font-family 和位置。

.glyphicon class 聲明一個從頂部偏移 1px 的相對位置,呈現(xiàn)為 inline-block,聲明字體,規(guī)定 font-style 和 font-weight 為 normal,設置行高為 1。除此之外,使用 -webkit-font-smoothing: antialiased-moz-osx-font-smoothing: grayscale; 獲得跨瀏覽器的一致性。

然后,這里的

.glyphicon:empty {
  width: 1em;
}

是空的 glyphicon。

這里有 200 個 class,每個 class 針對一個圖標。這些 class 的常見格式如下:

.glyphicon-keyword:before {
  content: "hexvalue";
}

比如,使用的 user 圖標,它的 class 如下:

.glyphicon-user:before {
  content: "e008";
}

用法

如需使用圖標,只需要簡單地使用下面的代碼即可。請在圖標和文本之間保留適當?shù)目臻g。

<span class="glyphicon glyphicon-search"></span>

下面的實例演示了如何使用字體圖標:

實例

<p> <button type="button" class="btn btn-default"> <span class="glyphicon glyphicon-sort-by-attributes"></span> </button> <button type="button" class="btn btn-default"> <span class="glyphicon glyphicon-sort-by-attributes-alt"></span> </button> <button type="button" class="btn btn-default"> <span class="glyphicon glyphicon-sort-by-order"></span> </button> <button type="button" class="btn btn-default"> <span class="glyphicon glyphicon-sort-by-order-alt"></span> </button> </p> <button type="button" class="btn btn-default btn-lg"> <span class="glyphicon glyphicon-user"></span> User </button> <button type="button" class="btn btn-default btn-sm"> <span class="glyphicon glyphicon-user"></span> User </button> <button type="button" class="btn btn-default btn-xs"> <span class="glyphicon glyphicon-user"></span> User </button>

運行代碼 ?

結果如下所示:

如何使用字體圖標

帶有字體圖標的導航欄

實例

<div class="navbar navbar-fixed-top navbar-inverse" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Project name</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li class="active"> <a href="#"> <span class="glyphicon glyphicon-home">Home</span></a> </li> <li> <a href="#shop"> <span class="glyphicon glyphicon-shopping-cart">Shop</span></a> </li> <li> <a href="#support"> <span class="glyphicon glyphicon-headphones">Support</span></a> </li> </ul> </div> <!-- /.nav-collapse --> </div> <!-- /.container --> </div> <!-- jQuery (Bootstrap 插件需要引入) --> <script src="http://cdn.static.json.cn/libs/jquery/2.1.1/jquery.min.js"></script> <!-- 包含了所有編譯插件 --> <script src="http://cdn.static.json.cn/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>

運行代碼 ?

定制字體圖標

我們已經看到如何使用字體圖標,接下來我們看看如何定制字體圖標。

我們將以上面的實例開始,并通過改變字體尺寸、顏色和應用文本陰影來進行定制圖標。

下面是開始的代碼:

<button type="button" class="btn btn-primary btn-lg">
  <span class="glyphicon glyphicon-user"></span> User
</button>

定制字體尺寸

通過增加或減少圖標的字體尺寸,您可以讓圖標看起來更大或更小。

<button type="button" class="btn btn-primary btn-lg" style="font-size: 60px">
  <span class="glyphicon glyphicon-user"></span> User
</button>

定制字體顏色

<button type="button" class="btn btn-primary btn-lg" style="color: rgb(212, 106, 64);">
  <span class="glyphicon glyphicon-user"></span> User
</button>

應用文本陰影

<button type="button" class="btn btn-primary btn-lg" style="text-shadow: black 5px 3px 3px;">
  <span class="glyphicon glyphicon-user"></span> User
</button>

在線定制字體圖標


圖標列表

圖標 類名 實例
glyphicon glyphicon-asterisk 運行代碼
glyphicon glyphicon-plus 運行代碼
glyphicon glyphicon-minus 運行代碼
glyphicon glyphicon-euro 運行代碼
glyphicon glyphicon-cloud 運行代碼
glyphicon glyphicon-envelope 運行代碼
glyphicon glyphicon-pencil 運行代碼
glyphicon glyphicon-glass 運行代碼
glyphicon glyphicon-music 運行代碼
glyphicon glyphicon-search 運行代碼
glyphicon glyphicon-heart 運行代碼
glyphicon glyphicon-star 運行代碼
glyphicon glyphicon-star-empty 運行代碼
glyphicon glyphicon-user 運行代碼
glyphicon glyphicon-film 運行代碼
glyphicon glyphicon-th-large 運行代碼
glyphicon glyphicon-th 運行代碼
glyphicon glyphicon-th-list 運行代碼
glyphicon glyphicon-ok 運行代碼
glyphicon glyphicon-remove 運行代碼
glyphicon glyphicon-zoom-in 運行代碼
glyphicon glyphicon-zoom-out 運行代碼
glyphicon glyphicon-off 運行代碼
glyphicon glyphicon-signal 運行代碼
glyphicon glyphicon-cog 運行代碼
glyphicon glyphicon-trash 運行代碼
glyphicon glyphicon-home 運行代碼
glyphicon glyphicon-file 運行代碼
glyphicon glyphicon-time 運行代碼
glyphicon glyphicon-road 運行代碼
glyphicon glyphicon-download-alt 運行代碼
glyphicon glyphicon-download 運行代碼
glyphicon glyphicon-upload 運行代碼
glyphicon glyphicon-inbox 運行代碼
glyphicon glyphicon-play-circle 運行代碼
glyphicon glyphicon-repeat 運行代碼
glyphicon glyphicon-refresh 運行代碼
glyphicon glyphicon-list-alt 運行代碼
glyphicon glyphicon-lock 運行代碼
glyphicon glyphicon-flag 運行代碼
glyphicon glyphicon-headphones 運行代碼
glyphicon glyphicon-volume-off 運行代碼
glyphicon glyphicon-volume-down 運行代碼
glyphicon glyphicon-volume-up 運行代碼
glyphicon glyphicon-qrcode 運行代碼
glyphicon glyphicon-barcode 運行代碼
glyphicon glyphicon-tag 運行代碼
glyphicon glyphicon-tags 運行代碼
glyphicon glyphicon-book 運行代碼
glyphicon glyphicon-bookmark 運行代碼
glyphicon glyphicon-print 運行代碼
glyphicon glyphicon-camera 運行代碼
glyphicon glyphicon-font 運行代碼
glyphicon glyphicon-bold 運行代碼
glyphicon glyphicon-italic 運行代碼
glyphicon glyphicon-text-height 運行代碼
glyphicon glyphicon-text-width 運行代碼
glyphicon glyphicon-align-left 運行代碼
glyphicon glyphicon-align-center 運行代碼
glyphicon glyphicon-align-right 運行代碼
glyphicon glyphicon-align-justify 運行代碼
glyphicon glyphicon-list 運行代碼
glyphicon glyphicon-indent-left 運行代碼
glyphicon glyphicon-indent-right 運行代碼
glyphicon glyphicon-facetime-video 運行代碼
glyphicon glyphicon-picture 運行代碼
glyphicon glyphicon-map-marker 運行代碼
glyphicon glyphicon-adjust 運行代碼
glyphicon glyphicon-tint 運行代碼
glyphicon glyphicon-edit 運行代碼
glyphicon glyphicon-share 運行代碼
glyphicon glyphicon-check 運行代碼
glyphicon glyphicon-move 運行代碼
glyphicon glyphicon-step-backward 運行代碼
glyphicon glyphicon-fast-backward 運行代碼
glyphicon glyphicon-backward 運行代碼
glyphicon glyphicon-play 運行代碼
glyphicon glyphicon-pause 運行代碼
glyphicon glyphicon-stop 運行代碼
glyphicon glyphicon-forward 運行代碼
glyphicon glyphicon-fast-forward 運行代碼
glyphicon glyphicon-step-forward 運行代碼
glyphicon glyphicon-eject 運行代碼
glyphicon glyphicon-chevron-left 運行代碼
glyphicon glyphicon-chevron-right 運行代碼
glyphicon glyphicon-plus-sign 運行代碼
glyphicon glyphicon-minus-sign 運行代碼
glyphicon glyphicon-remove-sign 運行代碼
glyphicon glyphicon-ok-sign 運行代碼
glyphicon glyphicon-question-sign 運行代碼
glyphicon glyphicon-info-sign 運行代碼
glyphicon glyphicon-screenshot 運行代碼
glyphicon glyphicon-remove-circle 運行代碼
glyphicon glyphicon-ok-circle 運行代碼
glyphicon glyphicon-ban-circle 運行代碼
glyphicon glyphicon-arrow-left 運行代碼
glyphicon glyphicon-arrow-right 運行代碼
glyphicon glyphicon-arrow-up 運行代碼
glyphicon glyphicon-arrow-down 運行代碼
glyphicon glyphicon-share-alt 運行代碼
glyphicon glyphicon-resize-full 運行代碼
glyphicon glyphicon-resize-small 運行代碼
glyphicon glyphicon-exclamation-sign 運行代碼
glyphicon glyphicon-gift 運行代碼
glyphicon glyphicon-leaf 運行代碼
glyphicon glyphicon-fire 運行代碼
glyphicon glyphicon-eye-open 運行代碼
glyphicon glyphicon-eye-close 運行代碼
glyphicon glyphicon-warning-sign 運行代碼
glyphicon glyphicon-plane 運行代碼
glyphicon glyphicon-calendar 運行代碼
glyphicon glyphicon-random 運行代碼
glyphicon glyphicon-comment 運行代碼
glyphicon glyphicon-magnet 運行代碼
glyphicon glyphicon-chevron-up 運行代碼
glyphicon glyphicon-chevron-down 運行代碼
glyphicon glyphicon-retweet 運行代碼
glyphicon glyphicon-shopping-cart 運行代碼
glyphicon glyphicon-folder-close 運行代碼
glyphicon glyphicon-folder-open 運行代碼
glyphicon glyphicon-resize-vertical 運行代碼
glyphicon glyphicon-resize-horizontal 運行代碼
glyphicon glyphicon-hdd 運行代碼
glyphicon glyphicon-bullhorn 運行代碼
glyphicon glyphicon-bell 運行代碼
glyphicon glyphicon-certificate 運行代碼
glyphicon glyphicon-thumbs-up 運行代碼
glyphicon glyphicon-thumbs-down 運行代碼
glyphicon glyphicon-hand-right 運行代碼
glyphicon glyphicon-hand-left 運行代碼
glyphicon glyphicon-hand-up 運行代碼
glyphicon glyphicon-hand-down 運行代碼
glyphicon glyphicon-circle-arrow-right 運行代碼
glyphicon glyphicon-circle-arrow-left 運行代碼
glyphicon glyphicon-circle-arrow-up 運行代碼
glyphicon glyphicon-circle-arrow-down 運行代碼
glyphicon glyphicon-globe 運行代碼
glyphicon glyphicon-wrench 運行代碼
glyphicon glyphicon-tasks 運行代碼
glyphicon glyphicon-filter 運行代碼
glyphicon glyphicon-briefcase 運行代碼
glyphicon glyphicon-fullscreen 運行代碼
glyphicon glyphicon-dashboard 運行代碼
glyphicon glyphicon-paperclip 運行代碼
glyphicon glyphicon-heart-empty 運行代碼
glyphicon glyphicon-link 運行代碼
glyphicon glyphicon-phone 運行代碼
glyphicon glyphicon-pushpin 運行代碼
glyphicon glyphicon-usd 運行代碼
glyphicon glyphicon-gbp 運行代碼
glyphicon glyphicon-sort 運行代碼
glyphicon glyphicon-sort-by-alphabet 運行代碼
glyphicon glyphicon-sort-by-alphabet-alt 運行代碼
glyphicon glyphicon-sort-by-order 運行代碼
glyphicon glyphicon-sort-by-order-alt 運行代碼
glyphicon glyphicon-sort-by-attributes 運行代碼
glyphicon glyphicon-sort-by-attributes-alt 運行代碼
glyphicon glyphicon-unchecked 運行代碼
glyphicon glyphicon-expand 運行代碼
glyphicon glyphicon-collapse-down 運行代碼
glyphicon glyphicon-collapse-up 運行代碼
glyphicon glyphicon-log-in 運行代碼
glyphicon glyphicon-flash 運行代碼
glyphicon glyphicon-log-out 運行代碼
glyphicon glyphicon-new-window 運行代碼
glyphicon glyphicon-record 運行代碼
glyphicon glyphicon-save 運行代碼
glyphicon glyphicon-open 運行代碼
glyphicon glyphicon-saved 運行代碼
glyphicon glyphicon-import 運行代碼
glyphicon glyphicon-export 運行代碼
glyphicon glyphicon-send 運行代碼
glyphicon glyphicon-floppy-disk 運行代碼
glyphicon glyphicon-floppy-saved 運行代碼
glyphicon glyphicon-floppy-remove 運行代碼
glyphicon glyphicon-floppy-save 運行代碼
glyphicon glyphicon-floppy-open 運行代碼
glyphicon glyphicon-credit-card 運行代碼
glyphicon glyphicon-transfer 運行代碼
glyphicon glyphicon-cutlery 運行代碼
glyphicon glyphicon-header 運行代碼
glyphicon glyphicon-compressed 運行代碼
glyphicon glyphicon-earphone 運行代碼
glyphicon glyphicon-phone-alt 運行代碼
glyphicon glyphicon-tower 運行代碼
glyphicon glyphicon-stats 運行代碼
glyphicon glyphicon-sd-video 運行代碼
glyphicon glyphicon-hd-video 運行代碼
glyphicon glyphicon-subtitles 運行代碼
glyphicon glyphicon-sound-stereo 運行代碼
glyphicon glyphicon-sound-dolby 運行代碼
glyphicon glyphicon-sound-5-1 運行代碼
glyphicon glyphicon-sound-6-1 運行代碼
glyphicon glyphicon-sound-7-1 運行代碼
glyphicon glyphicon-copyright-mark 運行代碼
glyphicon glyphicon-registration-mark 運行代碼
glyphicon glyphicon-cloud-download 運行代碼
glyphicon glyphicon-cloud-upload 運行代碼
glyphicon glyphicon-tree-conifer 運行代碼
glyphicon glyphicon-tree-deciduous 運行代碼