html5とCSS3による装飾サンプル
html5とCSS3のサンプルの実用的なものがたくさんあります。
その一部をランダムに表示しています。 詳しくは サンプルページへどうぞ
-
>>テキスト文字に色を付ける テキストに装飾
サンプルテキスト ABCDEFG
※ テキスト文字に淡色ではない色を付けます。
[ 閉じる ]
htmlソース
<p class="text-ex18"> サンプルテキスト ABCDEFG </p>
CSS
.text-ex18{ color: transparent; /* 透明を指定 */ background: linear-gradient(to right, red 0%, yellow 100%); /* グラデーション指定 */ background-clip: text; /* 要素の背景をtext で切り抜く */ width: 55% !important; /* グラデーションを文字全体にかけるため幅を調節します */ font-size: 30px !important; /* 強制的にフォントを大きくします */ }
-
>>見出しの装飾 - 左右にラインを入れる 見出しの装飾
見出しの装飾 - 左右にラインを入れる
※ 背景色を利用して疑似的にラインを描画します。
[ 閉じる ]
htmlソース
<h4 class="background-ex5"> <span>見出しの装飾 - 左右にラインを入れる</span> </h4>
CSS
.background-ex5 { margin-top: 12px !important; /* 本システムCSSの干渉を変更します */ position: relative; color: #333; font-size: 20px !important; font-weight: normal; display: flex; align-items: center; justify-content: center; } .background-ex5 span { position: relative; z-index: 100; display: inline-block; margin: 0 2.5em; padding: 0 1em; background-color: #fff; text-align: left; } .background-ex5::before { position: absolute; top: 50%; z-index: 1; content: ''; display: block; width: 100%; height: 1px; background-color: red; /* 線の色 */ }
-
>>画像の操作(1) ロールオーバー
※ 画像にエフェクトをかけます。 filterプロパティで行います。
この例では背景画像に対し 透過度を40%にしてモノクロにしています。
エフェクトはアニメーションで行っています。[ 閉じる ]
htmlソース
<p class="hover-ex5"> </p>
CSS
.hover-ex5 { height: 90px; width: 680px; box-sizing: border-box; background-image: url('/sysdata/images/sample/title_back1.png'); background-repeat: no-repeat; background-size: cover; background-position: center; transition: all .6s; } .hover-ex5:hover{ filter: grayscale(100%) opacity(40%); }