背景をうっすらグローパターンが通り抜ける見出しです。@keyframesで作ったアニメーションをうっすら通り抜けるので目を惹きます。
<h1 class="cp_h1title"><div class="glow"> </div>見出しテキスト</h1>
.cp_h1title {
position: relative;
z-index: 0;
color: #f8f8f8;
background-color: #d81b60;/*見出しの背景色*/
background-image:/*見出しの背景*/
linear-gradient(45deg,#c2185b 25%, #c2185b 25%,transparent 25%, transparent 75%,#c2185b 75%, #c2185b 75%),
linear-gradient(-45deg,#c2185b 25%, #c2185b 25%,transparent 25%, transparent 75%,#c2185b 75%, #c2185b 75%);
background-size: 10px 10px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);/*テキストの影*/
padding: 5px 10px;
}
.glow {
position: absolute;
z-index: 1;
top: 0;
width: 40px;
height: 100%;
animation: flow 3s linear infinite;
background: #ffffff;
background:
linear-gradient(to right, rgba(255,255,255,0) 0%,rgba(255,255,255,0) 1%,#ffffff 100%);
transform: skew(20deg);/*グロウの傾斜*/
}
@keyframes flow {
0% { left: -20%;opacity: 0; }
50% { left: 50%;opacity: 0.3; }
100% { left: 100%;opacity: 0; }
}
CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。
@CopypetJp More Info