<div class="cp_card">
コンテンツ
<div class="cp_ribbon01">
<div class="cp_ribbon">Ribbon</div>
</div>
</div>
.cp_card {
position: relative;/*リボンをかけたいコンテンツボックスにセット*/
width: 320px;
height: 340px;
background: #ffffff;
margin: 2em auto;
padding: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.cp_ribbon01 {
position: absolute;
top: -6px;
right: -6px;
width: 106px;
height: 108px;
overflow: hidden;
}
/*リボンの部分*/
.cp_ribbon01 .cp_ribbon {
position: relative;
top: 26px;
left: -11px;
font-size: 1em;
line-height: 1.2em;
width: 150px;
padding: 7px 0;
transform: rotate(45deg);
text-align: center;
color: #ffffff;
background-color: #2196F3;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
/*リボンの影の部分*/
.cp_ribbon01 .cp_ribbon::before,
.cp_ribbon01 .cp_ribbon::after {
position: absolute;
bottom: -4px;
content: '';
border-width: 4px 4px 0 4px;
border-style: solid;
border-color: #1565C0 transparent transparent transparent;
}
.cp_ribbon01 .cp_ribbon:before {
left: 0;
}
.cp_ribbon01 .cp_ribbon:after {
right: 0;
}