[パーツ]料金表などに使えるテーブルデザイン HOVERでブロックを強調

CSS HTML
 2018.01.23
 2018.03.19

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

料金の比較表などに使うテーブルのデザインです。
HOVERでブロックごと浮いて強調されます。
テーブルですがhtmlは<li>リストを使用しています。

browser:  65 11 20 10 
ニャン易度 
  • メニュー
  • ¥0,000
  • テキスト
  • テキスト
  • テキスト
  • テキスト
  • テキスト
  • ボタン
  • メニュー
  • ¥0,000
  • テキスト
  • テキスト
  • テキスト
  • テキスト
  • テキスト
  • ボタン
  • メニュー
  • ¥0,000
  • テキスト
  • テキスト
  • テキスト
  • テキスト
  • テキスト
  • ボタン
<div class="cp_pricetable1">
	<div class="block">
	<ul>
		<li class="header1">メニュー</li>
		<li class="header2">¥0,000</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="footer1"><a href="#" class="cp_btn">ボタン</a></li>
	</ul>
	</div>

	<div class="block">
	<ul>
		<li class="header1">メニュー</li>
		<li class="header2">¥0,000</li>
		<li class="style2">テキスト</li>
		<li class="style2">テキスト</li>
		<li class="style2">テキスト</li>
		<li class="style2">テキスト</li>
		<li class="style2">テキスト</li>
		<li class="footer2"><a href="#" class="cp_btn">ボタン</a></li>
	</ul>
	</div>

	<div class="block">
	<ul>
		<li class="header1">メニュー</li>
		<li class="header2">¥0,000</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="style1">テキスト</li>
		<li class="footer1"><a href="#" class="cp_btn">ボタン</a></li>
	</ul>
	</div>

</div>
.cp_pricetable1 {
	text-align: center;
	color: #444444;
}
.cp_pricetable1 .block {
	position: relative;
	float: left;
	width: 33%;
	height: 100%;
	transition: all 0.2s ease-in-out;
	-webkit-transform: translate(0px, 0px);
	transform: translate(0px, 0px);
}
.cp_pricetable1 .block ul, li {
	margin: 0;
	padding: 0;
	list-style-type: none;
}
/**** blockのhover ****/
.cp_pricetable1 .block:hover {
	position: relative;
	z-index: 100;
	transition-delay: 0s;
	-webkit-transform: translate(-2px,-2px);
	transform: translate(-2px,-2px);
	box-shadow: 0px 0 5px rgba(0,0,0,0.5);
}
.cp_pricetable1 .block:hover .header1,
.cp_pricetable1 .block:hover .header2,
.cp_pricetable1 .block:hover .style1,
.cp_pricetable1 .block:hover .style2,
.cp_pricetable1 .block:hover .footer1,
.cp_pricetable1 .block:hover .footer2 {
	padding: 0.5em;
}
/* --- メニュー名ブロック ---  */
.cp_pricetable1 .block .header1 {
	width: 100%;
	padding: 0.5em;
	color: #ffffff;
	border-bottom: 1px solid #ffffff;
	background: #131874;
}
/* --- 価格ブロック ---  */
.cp_pricetable1 .block .header2 {
	width: 100%;
	padding: 0.5em;
	border-top: 1px solid #131874;
	background: #a9bce2;
}
/* --- 詳細 ---  */
.cp_pricetable1 .block .style1,
.cp_pricetable1 .block .style2,
.cp_pricetable1 .block .footer1,
.cp_pricetable1 .block .footer2 {
	width: 100%;
	padding: 0.5em;
}
.cp_pricetable1 .block .footer1,
.cp_pricetable1 .block .footer2 {
	padding: 0.5em;
}
.cp_pricetable1 .block .style1,
.cp_pricetable1 .block .footer1 {
	background-color: #e8effc;
}
.cp_pricetable1 .block .style2,
.cp_pricetable1 .block .footer2 {
	background-color: #d7e3fc;
}
.cp_pricetable1 .block .style1,
.cp_pricetable1 .block .style2 {
	border-bottom: 1px dotted #ffffff;
}
/*ボタンデザイン*/
.cp_pricetable1 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_pricetable1 .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_pricetable1 .cp_btn:hover {
	color: #da3c41;
}
.cp_pricetable1 .cp_btn:hover::after {
	height: 250%;
	opacity: 1;
}
.cp_pricetable1 .cp_btn:active::after {
	height: 350%;
	opacity: 1;
}

copypet.jp

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

More Info

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