久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Bootstrap 字形圖標(biāo)(Glyphicons)

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

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

什么是字形圖標(biāo)(Glyphicons)?

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

為了表示對(duì)圖標(biāo)作者的感謝,希望您在使用時(shí)加上 GLYPHICONS 網(wǎng)站的鏈接。

獲取字形圖標(biāo)(Glyphicons)

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

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

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

字形圖標(biāo)(Glyphicons)列表

點(diǎn)擊這里,查看可用的字形圖標(biāo)(Glyphicons)列表。

CSS 規(guī)則解釋

下面的 CSS 規(guī)則構(gòu)成 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ī)則實(shí)際上是在找到 glyphicons 地方聲明 font-family 和位置。

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

然后,這里的

.glyphicon:empty {
  width: 1em;
}

是空的 glyphicon。

這里有 200 個(gè) class,每個(gè) class 針對(duì)一個(gè)圖標(biāo)。這些 class 的常見格式如下:

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

比如,使用的 user 圖標(biāo),它的 class 如下:

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

用法

如需使用圖標(biāo),只需要簡(jiǎn)單地使用下面的代碼即可。請(qǐng)?jiān)趫D標(biāo)和文本之間保留適當(dāng)?shù)目臻g。

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

下面的實(shí)例演示了如何使用字形圖標(biāo)(Glyphicons):

<!DOCTYPE html>
<html>
<head>
   <title>Bootstrap 實(shí)例 - 如何使用字形圖標(biāo)(Glyphicons)</title>
   <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
   <script src="/scripts/jquery.min.js"></script>
   <script src="/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>

<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>


</body>
</html>

結(jié)果如下所示:

如何使用字形圖標(biāo)(Glyphicons)

帶有導(dǎo)航欄的字形圖標(biāo)(Glyphicons)

<!DOCTYPE html>
<html>
  <head>
    <title>導(dǎo)航欄的字形圖標(biāo)</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link  rel="stylesheet">
    <style>
    body {
    padding-top: 50px;
    padding-left: 50px;
    }
    </style>
    <!--[if lt IE 9]>
      <script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <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://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <!-- 包含了所有編譯插件 -->
    <script src="http://apps.bdimg.com/libs/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  </body>
</html>		

定制字形圖標(biāo)(Glyphicons)

我們已經(jīng)看到如何使用字形圖標(biāo)(Glyphicons),接下來我們看看如何定制字形圖標(biāo)(Glyphicons)。

我們將以上面的實(shí)例開始,并通過改變字體尺寸、顏色和應(yīng)用文本陰影來進(jìn)行定制圖標(biāo)。

下面是開始的代碼:

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

效果如下所示:

定制字體尺寸

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

<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>

應(yīng)用文本陰影

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

在線定制字形圖標(biāo)(Glyphicons)

點(diǎn)擊這里,在線定制字形圖標(biāo)(Glyphicons)。

【網(wǎng)站聲明】本站除付費(fèi)源碼經(jīng)過測(cè)試外,其他素材未做測(cè)試,不保證完整性,網(wǎng)站上部分源碼僅限學(xué)習(xí)交流,請(qǐng)勿用于商業(yè)用途。如損害你的權(quán)益請(qǐng)聯(lián)系客服QQ:2655101040 給予處理,謝謝支持。

相關(guān)文檔推薦

自從有了類似Bootstrap這樣強(qiáng)大的前端框架之后,無論我們是做靜態(tài)頁面,還是做網(wǎng)站主題,著實(shí)方便很多。即便有很多類似的其他國產(chǎn)、海外的前端框架比較,Bootstrap用戶量以及功能文
未來的網(wǎng)頁設(shè)計(jì)趨勢(shì),我想響應(yīng)式設(shè)計(jì)是熱門,設(shè)計(jì)的時(shí)候都需要考慮其它設(shè)備瀏覽,比如手機(jī)、iPad平板電腦等手持設(shè)備。這樣雖然加大了設(shè)計(jì)師和前端人員的工作量,但卻有著很好的
免費(fèi)的響應(yīng)式Bootstrap模板 - Codester 在線演示 Codester是一個(gè)基本的個(gè)人作品集Bootstrap模板,幫助設(shè)計(jì)師,攝影師,圖形藝術(shù)工作者搭建高度可定制的網(wǎng)站。擁有自定義包和相關(guān)的javascrip
1. 簡(jiǎn)介 Bootstrap 是 Twitter 推出的一個(gè)開源的前端框架。 Bootstrap 由 Twitter 的設(shè)計(jì)師 Mark Otto 和 Jacob Thornton 合作開發(fā),由動(dòng)態(tài)語言 Less 寫成。它是一套易用、優(yōu)雅、靈活、可擴(kuò)展的前端工具
這里收集了Bootstrap從V1.0.0版本到現(xiàn)在,整個(gè)文檔的歷史。Bootstrap本身就是一個(gè)傳奇,而這些文檔就是傳奇的見證! 最新版本文檔 版本 發(fā)布日期 2.3.2 May 17, 2013 2.3.1 February 28, 2013 2.3.0 F
Bootstrap 教程 Bootstrap,來自 Twitter,是目前最受歡迎的前端框架。Bootstrap 是基于 HTML、CSS、JAVASCRIPT 的,它簡(jiǎn)潔靈活,使得 Web 開發(fā)更加快捷。 本教程將向您講解 Bootstrap 框架的基礎(chǔ),通過
主站蜘蛛池模板: 91久久久久久久久 | 黄色一区二区三区 | 欧美成人一级片 | 久久精品久久久久久久 | 欧美高清一区二区 | 日韩视频一区二区三区 | 一级片免费播放 | 亚洲午夜一区 | 91久久国产精品 | 一级片在线视频 | 中文字幕永久免费 | 偷拍福利视频 | 日本免费观看视频 | 亚洲精品美女 | 精品国产一区二区在线观看 | 久久久久国产精品夜夜夜夜夜 | 亚洲国产福利 | 国产伦精品一区二区三区88av | 日韩小视频在线观看 | 日韩在线视频播放 | 久久视频一区二区 | 欧美中文字幕在线观看 | 亚洲第一伊人 | 婷婷精品 | 久久精品一区二区国产 | 九九视频在线免费观看 | 亚洲视频一区在线观看 | 精品久久网站 | 黄色裸体视频 | 综合久久99 | 一区二区不卡视频 | 在线成人免费视频 | 精品视频一区二区 | 成人在线视频免费观看 | 黄色片在线看 | 91av视频| 综合久久99| 黄色一级片免费 | 91久久综合亚洲鲁鲁五月天 | 免费在线小视频 | 精品国产va久久久久久久 |