Twitter Bootstrap2.3.1でテーブルでホバー時に色付を指定します。
【準備】
1.「Twitter Bootstrap2.3.1の使用方法」の手順の通り、Twitter Bootstrapを配置しておきます。
【手順1】
1.HTMLファイル「index.html」(任意)を作成。
2.「index.html」を以下の様に入力。
<!DOCTYPE html>
<html>
<head>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<table class="table table-hover">
<caption>テーブルのタイトル</caption>
<thead>
<tr>
<th>名前</th>
<th>年齢</th>
<th>性別</th>
</tr>
</thead>
<tbody>
<tr>
<td>あいうえお</td>
<td>11</td>
<td>男</td>
</tr>
<tr>
<td>かきくけこ</td>
<td>22</td>
<td>女</td>
</tr>
<tr>
<td>さしすせそ</td>
<td>33</td>
<td>男</td>
</tr>
</tbody>
</table>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
【手順2】
1.「table-hover」クラスは以下の様に定義されていました。
.table-hover tbody tr:hover > td,
.table-hover tbody tr:hover > th {
background-color: #f5f5f5;
}
【手順3】
1.ブラウザで「index.html」を開き、以下の様に表示されれば成功です。
以上です。
-01.png)
0 件のコメント:
コメントを投稿
注: コメントを投稿できるのは、このブログのメンバーだけです。