[装飾系]リボン 上全体にかかったリボン2

CSS HTML
 2018.03.05
 2018.03.23

上全体にかかったリボン

ブロックの上にかかったリボンデザインです。
両端がV字にカットしたものです。

browser:  65 11 20 10 
ニャン易度 
images
Ribbon
<div class="cp_card">
コンテンツ
	<div class="cp_ribbon12">
		<div class="cp_ribbon">Ribbon</div>
	</div>
</div>
.cp_card {
	width: 320px;
	height: 340px;
	position: relative;
	background: #ffffff;
	overflow: visible;
	margin: 2em auto;
	padding: 0.5em;
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.cp_ribbon12 {
	position: absolute;
	z-index: 200;
	top: 15px;
	width: calc(100% + 20px);
	height: 50px;
	margin-right: -18px;
	margin-bottom: 80px;
	margin-left: -18px;
}
.cp_ribbon12:before, .cp_ribbon12:after {
	position: absolute;
	top: 20px;
	bottom: -10px;
	width: 0;
	height: 0;
	content: '';
	border-width: 20px 20px;
}
.cp_ribbon12:before {
	left: -30px;
	border-style: solid;
	border-color: #F06292 #F06292 #F06292 transparent;
}
.cp_ribbon12:after {
	right: -30px;
	border-style: solid;
	border-color: #F06292 transparent #F06292 #F06292;
}
.cp_ribbon12 .cp_ribbon {
	line-height: 3em;
	position: relative;
	z-index: 100;
	height: inherit;
	margin-bottom: 0;
	text-align: center;
	color: #ffffff;
	background: #F48FB1;
}
.cp_ribbon12 .cp_ribbon:before, .cp_ribbon12 .cp_ribbon:after {
	position: absolute;
	bottom: -10px;
	width: 0;
	height: 0;
	content: '';
	border-top: 10px solid #C2185B;
}
.cp_ribbon12 .cp_ribbon:before {
	left: 0;
	border-left: 10px solid transparent;
}
.cp_ribbon12 .cp_ribbon:after {
	right: 0;
	border-right: 10px solid transparent;
}

copypet.jp

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

More Info

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