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

CSS HTML
 2018.03.05
 2018.03.23

上全体にかかったリボン

ブロックの上にかかったリボンデザインです。

browser:  65 11 20 10 
ニャン易度 
images
Ribbon
<div class="cp_card">
コンテンツ
	<div class="cp_ribbon11">
		<span>Ribbon</span>
	</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_ribbon11 {
	line-height: 50px;
	position: absolute;
	top: 15px;
	display: block;
	width: calc(100% + 20px);
	height: 50px;
	margin-right: -10px;
	margin-left: -18px;
	text-align: center;
	color: #ffffff;
	background: #2196F3;
}
.cp_ribbon11:before, .cp_ribbon11:after {
	position: absolute;
	content: '';
}
.cp_ribbon11:before {
	bottom: -10px;
	left: 0;
	width: 0;
	height: 0;
	border-top: 10px solid #1565C0;
	border-left: 10px solid transparent;
}
.cp_ribbon11:after {
	right: 0;
	bottom: -10px;
	width: 0;
	height: 0;
	border-top: 10px solid #1565C0;
	border-right: 10px solid transparent;
}

copypet.jp

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

More Info

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