[パーツ]料金表などに使えるテーブルデザイン 強調したいブロックのみ色を変更

CSS HTML
 2018.01.23
 2018.03.19

料金表などに使えるテーブルデザイン

料金の比較表などに使うテーブルのデザインです。
左側に項目をまとめて表示し、強調したいもののみ色を変更しています。

browser:  65 11 20 10 
ニャン易度 
テキスト テキスト テキスト
ボタン ボタン ボタン
テキストテキスト テキスト テキスト テキスト
テキストテキスト テキスト テキスト テキスト
テキストテキスト テキスト テキスト テキスト
テキストテキスト テキスト テキスト テキスト
<table class="cp_pricetable2">
<thead>
	<tr>
		<td></td>
		<td>テキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
	</tr>
</thead>
<tfoot>
	<tr>
		<td></td>
		<td><a href="#" class="cp_btn">ボタン</a></td>
		<td><a href="#" class="cp_btn">ボタン</a></td>
		<td><a href="#" class="cp_btn">ボタン</a></td>
	</tr>
</tfoot>
<tbody>
	<tr>
		<td>テキストテキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
	</tr>
	<tr>
		<td>テキストテキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
	</tr>
	<tr>
		<td>テキストテキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
	</tr>
	<tr>
		<td>テキストテキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
		<td>テキスト</td>
	</tr>
</tbody>
</table>
.cp_pricetable2 {
	margin: 0 auto;
	padding: 0em;
	border-spacing: 1px 0;
	border-radius: 6px;
	background: #e8effc;
}
.cp_pricetable2 td {
	height: 50px;
	padding: 0 20px;
	text-align: center;
	border-bottom: 1px solid #cdcdcd;
}
/*main tableブロック*/
.cp_pricetable2 tbody td {
	width: 25%;
	text-align: center;
}
/* --リスト名ブロック */
.cp_pricetable2 tbody td:first-child {
	font-size: 0.8em;
	width: auto;
	text-align: left;
	white-space: nowrap;
}
.cp_pricetable2 tbody td:first-child::before {
	font-family: 'FontAwesome';
	content: ' \f0da';
}
/* --2,3列目 */
.cp_pricetable2 td:nth-child(2),
.cp_pricetable2 td:nth-child(3) {
	border-right: 1px solid #ffffff;
	background: #a9bce2;
}
/* --4列目 */
.cp_pricetable2 td:nth-child(4) {
	color: #ffffff;
	background: #131874;
}
/*Header テキストブロック*/
.cp_pricetable2 thead td {
	font-size: 1.2em;
	font-weight: bold;
	border-top: none;
	border-radius: 6px 6px 0 0;
}
/*Footer ボタンブロック*/
.cp_pricetable2 tfoot td {
	border-bottom: none;
	border-radius: 0 0 6px 6px;
}
/*ボタンデザイン*/
.cp_pricetable2 a.cp_btn {
	position: relative;
	z-index: 1;
	display: block;
	overflow: hidden;
	width: 100px;
	margin-right: auto;
	margin-left: auto;
	padding: 0.3em 1em;
	text-align: center;
	text-decoration: none;
	color: #ffffff;
	border: 1px solid #da3c41;
	border-radius: 4px;
	background: #da3c41;
}
.cp_pricetable2 .cp_btn:after {
	position: absolute;
	z-index: -1;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 0;
	content: '';
	transition: 0.3s;
	-webkit-transform: translate(-50%,-50%) rotate(45deg);
	transform: translate(-50%,-50%) rotate(45deg);
	opacity: 0;
	background: #ffffff;
}
.cp_pricetable2 .cp_btn:hover {
	color: #da3c41;
}
.cp_pricetable2 .cp_btn:hover:after {
	height: 250%;
	opacity: 1;
}
.cp_pricetable2 .cp_btn:active:after {
	height: 350%;
	opacity: 1;
}

copypet.jp

CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。

More Info

こんな記事はいかがですか?