1. 程式人生 > >Bootstrap 布局組件

Bootstrap 布局組件

ole 陰影 alt tro head href tab dropdown 按鈕

1.Bootstrap 字體圖標(Glyphicons)

Bootstrap 捆綁了 200 多種字體格式的字形。

1.1用法

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

技術分享

1.2定制字體圖標

1.2.1定制字體尺寸

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

技術分享

1.2.2定制字體顏色

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

技術分享

1.2.3應用文本陰影

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

技術分享

2.Bootstrap 下拉菜單(Dropdowns)

使用下拉菜單,只需要在 class .dropdown 內加上下拉菜單即可。

<div class="dropdown">
    <button type="button" class="btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">主題
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
        <li role="presentation" class="dropdown-header">下拉菜單標題</li>
        <li role="presentation">
            <a role="menuitem" tabindex="-1" href="#">Java</a>
        </li>
        <li role="presentation">
            <a role="menuitem" tabindex="-1" href="#">數據挖掘</a>
        </li>
        <li role="presentation">
            <a role="menuitem" tabindex="-1" href="#">數據通信/網絡</a>
        </li>
        <li role="presentation" class="divider"></li>
        <li role="presentation" class="dropdown-header">下拉菜單標題</li>
        <li role="presentation">
            <a role="menuitem" tabindex="-1" href="#">分離的鏈接</a>
        </li>
    </ul>
</div>

技術分享

3.Bootstrap 按鈕組

<div class="btn-toolbar" role="toolbar">
<div class="btn-group btn-group-lg">
    <button type="button" class="btn btn-default">按鈕 1</button>
    <button type="button" class="btn btn-default">按鈕 2</button>
    <button type="button" class="btn btn-default">按鈕 3</button>
</div>
    <div class="btn-group btn-group-sm">
    <button type="button" class="btn btn-default">按鈕 4</button>
    <button type="button" class="btn btn-default">按鈕 5</button>
    <button type="button" class="btn btn-default">按鈕 6</button>
</div>
    <div class="btn-group btn-group-xs">
    <button type="button" class="btn btn-default">按鈕 7</button>
    <button type="button" class="btn btn-default">按鈕 8</button>
    <div class="btn-group">
    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
        下列
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu">
        <li><a href="#">下拉鏈接 1</a></li>
        <li><a href="#">下拉鏈接 2</a></li>
    </ul>
    </div>
</div>
</div>

技術分享

3.1垂直的按鈕組

<div class="btn-group-vertical">
    <button type="button" class="btn btn-default">按鈕 1</button>
    <button type="button" class="btn btn-default">按鈕 2</button>
    <div class="btn-group-vertical">
    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
        下拉
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu">
        <li><a href="#">下拉鏈接 1</a></li>
        <li><a href="#">下拉鏈接 2</a></li>
    </ul>
    </div>
</div>

技術分享

Bootstrap 布局組件