html5とCSS3による装飾サンプル
html5とCSS3のサンプルの実用的なものがたくさんあります。
その一部をランダムに表示しています。 詳しくは サンプルページへどうぞ
-
>>見出しを下線で装飾する(2) 見出しの装飾
見出しを下線で装飾する 方法その(2)
※ h4タグ属性のボーダーに対して太さ色で装飾をする。 色のグラデーションは green → whiteと設定
linear-gradient( グラデーションの角度または方向, 開始色, 途中色, 終了色 )[ 閉じる ]
htmlソース
<h4 class="title-ex2"> 見出しを下線で装飾する 方法その(2) </h4>
CSS
.title-ex2 { padding: 0 0 8px 0 !important; /* 本システムCSSの干渉を変更します */ border-bottom: 16px solid; border-image: linear-gradient(to right, green 0%, #fff 100%); border-image-slice: 1; display: flex; align-items: flex-end !important; /* 下線に合わせるため */ line-height: 10px; color: #333; font-size: 20px !important; font-weight: normal; }
-
>>タイトルにアイコンをつける(border-1) アイコンで装飾
タイトルにアイコンをつける
※ CSSでボーダーを変形させてアイコンを作成しています。
画像を用意しなくて良いので便利ではあります。[ 閉じる ]
htmlソース
<h4 class="icon-ex1"> タイトルにアイコンをつける </h4>
CSS
.icon-ex1 { font-size: 20px; font-weight: normal; color: #333; padding: 1rem; display: flex; align-items: center; height: 36px; } .icon-ex1::before { content: ''; width: 20px; height: 20px; border: 6px solid pink; border-radius: 20px; margin-right: 8px; }
-
>>画像の操作(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%); }