html5とCSS3による装飾サンプル
html5とCSS3のサンプルの実用的なものがたくさんあります。
その一部をランダムに表示しています。 詳しくは サンプルページへどうぞ
-
>>見出しを下線で装飾する(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%); }
-
>>テキストに蛍光ペン風マーキング テキストに装飾
サンプルテキスト ABCDEFG あいうえおかきくけこ
※ テキストに蛍光ペンでマークしたような効果の装飾をします。
[ 閉じる ]
htmlソース
<p class="text-ex19"> サンプルテキスト <em>ABCDEFG</em> あいうえおかきくけこ </p>
CSS
.text-ex19{ line-height: 1; font-size: 20px !important; /* 強制的にフォントを大きくします */ padding: 1rem; } .text-ex19 em { background: linear-gradient(transparent 30%, yellow 60%); /* マーキングする */ }
-
[ 閉じる ]
htmlソース
<p class="hover-ex9"> <a href="#">サンプルテキスト</a> </p>
CSS
.hover-ex9{ height: 32px !important; /* 本システムCSSの干渉を変更します */ width: 200px !important; /* 本システムCSSの干渉を変更します */ display: flex; align-items: center; } .hover-ex9 a{ display: block; width: 100%; height: 100%; padding: 8px 20px 8px 20px; background-color: #fff; color: #333; text-decoration-line: none; line-height: 1.6; outline: solid 1px transparent; outline-offset: -18px; transition: all .6s; } .hover-ex9 a:hover{ color: #666; background-color: cornsilk; outline: solid 1px #666; outline-offset: 0px; }