.NET開発者のためのブログメディア
Bootstrapのサンプルとは?Bootstrapのサンプルについて解説!

- SE
- Bootstrapのサンプルを使用するとどのようなことができるのでしょうか。
- PM
- Bootstrapを利用すると、良いデザインのページを作成できます。
目次
Bootstrapのサンプルとは?
今回は、Bootstrapのサンプルを紹介します。
Bootstrapを利用すると、良いデザインのページを作成できます。
ここでは、
・ボタン
・テーブル
・アラート
・ツールチップ
のサンプルを紹介します。
Bootstrapに興味のある方はぜひご覧ください。
ボタン
Bootstrapでのボタンのサンプルを紹介します。
1
2
3
4
5
6
7
8
9
10
|
<button type="button" class="btn">Button normal</button>
<button type="button" class="btn btn-primary btn-sm">Primary sm</button>
<button type="button" class="btn btn-secondary btn-lg">Secondary lg</button>
<button type="button" class="btn btn-success btn-block">Success block</button>
<button type="button" class="btn btn-danger">Danger normal</button>
<button type="button" class="btn btn-warning btn-sm">Warning sm</button>
<button type="button" class="btn btn-info btn-lg">Info lg</button>
<button type="button" class="btn btn-light btn-block">Light block</button>
<button type="button" class="btn btn-dark">Dark normal</button>
<button type="button" class="btn btn-link btn-sm">Link sm</button>
|
See the Pen
bootstrap_sample1 by kskumd (@kskumd)
on CodePen.
btn-primary、btn-secondary、btn-successなどでボタンの色を指定できます。
また、btn-sm、btn-lg、btn-blockなどでボタンのサイズを指定できます。
テーブル
Bootstrapでのテーブルのサンプルを紹介します。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<table class="table table-striped">
<caption>table-striped, thead-dark</caption>
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Age</th>
<th scope="col">Gender</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Tanaka</td>
<td>30</td>
<td>male</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Sato</td>
<td>25</td>
<td>female</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Suzuki</td>
<td>35</td>
<td>male</td>
</tr>
</tbody>
</table>
|
See the Pen
bootstrap_sample2 by kskumd (@kskumd)
on CodePen.
table-stripedを指定すると、ストライプのテーブルになります。
thead-darkを指定すると、ヘッダの色を指定できます。
アラート
Bootstrapでのアラートのサンプルを紹介します。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<div class="alert alert-primary" role="alert">
<strong>alert-primary</strong>
</div>
<div class="alert alert-secondary" role="alert">
<strong>alert-secondary</strong>
</div>
<div class="alert alert-success" role="alert">
<strong>alert-success</strong>
</div>
<div class="alert alert-danger" role="alert">
<strong>alert-danger</strong>
</div>
<div class="alert alert-warning" role="alert">
<strong>alert-warning</strong>
</div>
<div class="alert alert-info" role="alert">
<strong>alert-info</strong>
</div>
<div class="alert alert-light" role="alert">
<strong>alert-light</strong>
</div>
<div class="alert alert-dark" role="alert">
<strong>alert-dark</strong>
</div>
|
See the Pen
bootstrap_sample4 by kskumd (@kskumd)
on CodePen.
alert-primary、alert-secondaryなどを指定すると、アラートの色を指定できます。
ツールチップ
Bootstrapでのツールチップのサンプルを紹介します。
ツールチップを使用するには、JavaScriptに以下のように記述してください。
1
|
$('[data-toggle="tooltip"]').tooltip();
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<button type="button" class="btn btn-primary" data-toggle="tooltip" title="Tooltip">
Tooltip
</button>
<button type="button" class="btn btn-primary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip(top)
</button>
<button type="button" class="btn btn-primary" data-toggle="tooltip" data-placement="right" title="Tooltip on right">
Tooltip(right)
</button>
<button type="button" class="btn btn-primary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">
Tooltip(bottom)
</button>
<button type="button" class="btn btn-primary" data-toggle="tooltip" data-placement="left" title="Tooltip on left">
Tooltip(left)
</button>
|
See the Pen
bootstrap_sample5 by kskumd (@kskumd)
on CodePen.
data-placementを指定すれば、ツールチップの表示場所を変更できます。
- SE
- Bootstrapのサンプルを使用すると、良質なデザインを作ることができるのですね。
- PM
- こちらで紹介したサンプル以外にもさまざまな種類がありますので、ご自身に必要なサンプルを探してみてください。
Bootstrapのサンプルについて知ろう
Bootstrapのサンプルを紹介しました。
Bootstrapを利用すると、デザインの良いページを作成することができます。
ここでは、
・ボタン
・テーブル
・アラート
・ツールチップ
のサンプルを紹介しました。
紹介したサンプル以外にも様々な要素がありますので、調べてみてください。
Search キーワード検索
Popular 人気の記事
reccomended おすすめ記事
Categories 連載一覧
Tags タグ一覧
Jobs 新着案件
-
開発エンジニア/東京都品川区/【WEB面談可】/在宅ワーク
月給29万~30万円東京都品川区(大崎駅) -
遠隔テストサービス機能改修/JavaScript/東京都港区/【WEB面談可】/テレワーク
月給45万~60万円東京都港区(六本木駅) -
病院内システムの不具合対応、保守/東京都豊島区/【WEB面談可】/テレワーク
月給30万~30万円東京都豊島区(池袋駅) -
開発/JavaScript/東京都豊島区/【WEB面談可】/テレワーク
月給50万~50万円東京都豊島区(大塚駅) -
債権債務システム追加開発/東京都文京区/【WEB面談可】/在宅勤務
月給62万~67万円東京都文京区(後楽園駅)