html5とCSS3による装飾サンプル
html5とCSS3のサンプルの実用的なものがたくさんあります。
その一部をランダムに表示しています。 詳しくは サンプルページへどうぞ
-
>>文字の背景のエフェクト(アニメーション)(2) ロールオーバー
※ マウスオーバーのエフェクトをCSSで実現します。
外枠が放射状に広がり消えます。 CSSのoutlineで処理しています。[ 閉じる ]
htmlソース
<p class="hover-ex8"> <a href="#">サンプルテキスト</a> </p>
CSS
.hover-ex8{ height: 32px !important; /* 本システムCSSの干渉を変更します */ width: 200px !important; /* 本システムCSSの干渉を変更します */ display: flex; align-items: center; } .hover-ex8 a{ display: block; width: 100%; height: 100%; padding: 8px 20px 8px 20px; background-color: darkcyan; color: #fff; font-size: 20px; font-weight: normal; text-decoration-line: none; line-height: 1.6; outline: 2px solid darkcyan; } .hover-ex8 a:hover{ outline-color: transparent; outline-offset: 12px; transition: all 0.6s; }
-
>>見出しを下線で装飾する(1) 見出しの装飾
見出しを下線で装飾する 方法その(1)
※ タイトル(テキスト)の下線をposition → absoluteを利用して相対的な位置指定で 装飾する。
[ 閉じる ]
htmlソース
<h4 class="title-ex1"> 見出しを下線で装飾する 方法その(1) </h4>
CSS
.title-ex1{ position: relative; padding: 0.3em 0.3em 0.5em 0 !important; /* 本システムCSSの干渉を変更します */ color: #333; height: 32px; font-size: 20px !important; font-weight: normal; display: flex; align-items: center; } .title-ex1::after { position: absolute; bottom: 2px; left: 0; z-index: -1; content: ''; width: 100%; height: 16px; background: linear-gradient(45deg, green 50%, white 100%); }
-
>>見出しのアイコンをテキストキャラクターで代用する(2) アイコンで装飾
■見出しにアイコンをつける(テキストキャラクター2)
※ サンプルにするまでもないのですが、最もシンプルなテキスト利用例です。
htmlコーディングの超初心者向け?です。 (^_^;)[ 閉じる ]
htmlソース
<h4 class="icon-ex9"> <span>■</span>見出しにアイコンをつける(テキストキャラクター2) </h4>
CSS
.icon-ex9{ font-size: 20px; font-weight: normal; color: #333; padding: 1rem; display: flex; align-items: center; height: 36px; } .icon-ex9 span { font-size: 0.9em; color: pink; padding-right: 8px; }