html5とCSS3による装飾サンプル
html5とCSS3のサンプルの実用的なものがたくさんあります。
その一部をランダムに表示しています。 詳しくは サンプルページへどうぞ
-
>>見出しを下線で装飾する(3) 見出しの装飾
見出しを下線で装飾する 方法その(3)
※ テキストのbackground属性を利用して装飾する。
[ 閉じる ]
htmlソース
<p class="title-ex3"> 見出しを下線で装飾する 方法その(3) </p>
CSS
.title-ex3 { padding: 0 0 4px 0 !important; /* 本システムCSSの干渉を変更します */ background-image: linear-gradient(to right, green, white); background-repeat: no-repeat; background-size: 100% 32%; background-position: bottom; color: #333; height: 48px !important; font-size: 20px !important; font-weight: normal; }
-
>>見出しの装飾 - 左右にラインを入れる 見出しの装飾
見出しの装飾 - 左右にラインを入れる
※ 背景色を利用して疑似的にラインを描画します。
[ 閉じる ]
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; /* 線の色 */ }
-
>>画像の操作(2) ロールオーバー
※ 画像にエフェクトをかけます。 filterプロパティで行います。
この例では背景画像に対し ポジ・ネガ反転します。
エフェクトはアニメーションで行っています。[ 閉じる ]
htmlソース
<p class="hover-ex6"> </p>
CSS
.hover-ex6 { 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-ex6:hover{ filter: invert(200%); }