html5とCSS3による装飾サンプル
html5とCSS3のサンプルの実用的なものがたくさんあります。
その一部をランダムに表示しています。 詳しくは サンプルページへどうぞ
-
>>テキストを変形する(2) - 斜め テキストに装飾
サンプルテキスト ABCDEFG
※ テキストに斜体をかけます。この例ではY軸で斜体をかけています。
[ 閉じる ]
htmlソース
<p class="text-ex14"> サンプルテキスト ABCDEFG </p>
CSS
.text-ex14{ transform: skewY(-5deg); /* Y軸で斜体をかけます */ font-size: 30px !important; /* わかりやすいようにフォントを大きくします */ font-weight: normal; padding: 1rem; }
-
>>タイトルにSVGでアイコンをつける(3) アイコンで装飾
タイトルにアイコンをつける(SVG-3)
※ タイトルにSVGでアイコンをつける。 このSVGはMITライセンスでの利用となります。
The MIT License (MIT) Copyright © 2019-2020 css.gg
他にもアイコンがいっぱいあります。 https://css.gg/[ 閉じる ]
htmlソース
<h4 class="icon-ex5"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M10.2426 16.3137L6 12.071L7.41421 10.6568L10.2426 13.4853L15.8995 7.8284L17.3137 9.24262L10.2426 16.3137Z" fill="currentColor" /><path fill-rule="evenodd" clip-rule="evenodd" d="M1 5C1 2.79086 2.79086 1 5 1H19C21.2091 1 23 2.79086 23 5V19C23 21.2091 21.2091 23 19 23H5C2.79086 23 1 21.2091 1 19V5ZM5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3Z" fill="currentColor" /> </svg> タイトルにアイコンをつける(SVG-3) </h4>
CSS
.icon-ex5{ font-size: 20px; font-weight: normal; color: #333; padding: 1rem; display: flex; align-items: center; height: 36px; } .icon-ex5 svg { width: 24px; margin-right: 8px; margin-bottom: 4px; }
-
>>背景の装飾 - 色のグラデーション (3) 見出しの装飾
背景の装飾 色のグラデーション (3)
※ 背景をベタ塗ではなくグラデーションの指定で塗ります。
red(赤)からyellow(黄色) への縦のグラデーションです。[ 閉じる ]
htmlソース
<h4 class="background-ex3"> 背景の装飾 色のグラデーション (3) </h4>
CSS
.background-ex3 { padding-left: 20px !important; /* 本システムCSSの干渉を変更します */ background: linear-gradient(transparent 0%, red 70%, yellow 90%); color: #fff; font-size: 20px !important; font-weight: normal; height: 56px !important; display: flex; align-items: center; }