html5とCSS3による装飾サンプル
html5とCSS3のサンプルの実用的なものがたくさんあります。
その一部をランダムに表示しています。 詳しくは サンプルページへどうぞ
-
>>見出しを四角い枠で囲う 見出しの装飾
見出しを四角い枠で囲う
※ 見出しを四角い枠で囲います。 太さ、色、べた塗りなどいろいろ可能です。
[ 閉じる ]
htmlソース
<h4 class="title-ex7"> 見出しを四角い枠で囲う </h4>
CSS
.title-ex7{ padding: 12px 20px !important; /* 本システムCSSの干渉を変更します */ color: #333; border: solid 2px lightgray; color: #333; font-size: 20px !important; font-weight: normal; }
-
>>画像の操作(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%); }
-
>>タイトルにアイコンをつける (border-4) アイコンで装飾
タイトルにアイコンをつける
※ CSSでボーダーを変形させてアイコンを作成しています。
borderの角の描画特性を利用したアイコンです。 画像を用意しなくて良いので便利ではあります。[ 閉じる ]
htmlソース
<h4 class="icon-ex11"> タイトルにアイコンをつける </h4>
CSS
.icon-ex11{ position: relative; font-size: 20px; font-weight: normal; position: relative; padding-left: 20px !important; display: flex; align-items: center; height: 36px; } .icon-ex11::before { position: absolute; content: ''; box-sizing: border-box; left: 0; width: 6px; height: 10px; background: pink; } .icon-ex11::after { position: absolute; content: ''; box-sizing: border-box; left: 6px; border: 10px solid transparent; border-left: 10px solid pink; margin-right: 10px; }