擬似要素で左に吹き出しをつけてそこにチェックマーク入れた見出しです。
チェックマークはfontawesomeの利用が不可の時などに代わりに使える、機種依存文字を利用しています。
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
position: relative;
padding-left: 35px;
}
.cp_h1title:before{
position: absolute;
content: ".cp_h1title {
position: relative;
padding-left: 35px;
}
.cp_h1title:before{
position: absolute;
content: "\002713";
background: #1E88E5;
color: #fff;
font-size: .7em;
top: 50%;
left: 0;
width: 1.5em;
height: 1.5em;
line-height: 1.5em;
text-align: center;
border-radius: 50%;
transform: translateY(-50%);
}
.cp_h1title:after {
content: '';
display: block;
position: absolute;
top: 50%;
left: 0.9em;
height: 0;
width: 0;
border-style: solid;
border-width: 6px 0 6px 10.4px;
border-color: transparent transparent transparent #1E88E5;
transform: translateY(-50%);
}
2713";
background: #1E88E5;
color: #fff;
font-size: .7em;
top: 50%;
left: 0;
width: 1.5em;
height: 1.5em;
line-height: 1.5em;
text-align: center;
border-radius: 50%;
transform: translateY(-50%);
}
.cp_h1title:after {
content: '';
display: block;
position: absolute;
top: 50%;
left: 0.9em;
height: 0;
width: 0;
border-style: solid;
border-width: 6px 0 6px 10.4px;
border-color: transparent transparent transparent #1E88E5;
transform: translateY(-50%);
}
CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。
@copypet_jp More Info