htmlとcssだけでできる下線装飾の見出し15選です。
見出し次第で、記事の読みやすさは大きく変わります。
おもに、下線をデザインするだけのシンプルな見出しのみです。
色は好みで変えていただければ、かまいません。
また、基本htmlは<h1>タグを使用していますが、<h2>〜<h6>などにそのまま変更することができます。
紹介している<h1>タグには、クラス名(.cp_h1title)を付与していますが、こちらも
css部分を下記のように変更すれば、クラスをつけずに使用することも可能です。
h1 {cssの中身}
色には6桁の16進数のカラーコード(#000000)も使えますが、他に、
なども使用できます。
RGBA値での指定は、サポートしていないブラウザだと、透明度だけが無視されるのではなく、色指定そのものが認識されずに無効となるので注意が必要です。
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
padding: .3em;
border-bottom: 2px dashed #29B6F6;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
padding: .3em;
border-bottom: 2px dotted #F4511E;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
padding: .3em;
border-bottom: 3px double #0097A7;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
position: relative;
padding: .3em;
}
.cp_h1title::before {
position: absolute;
left: 0;
content: '';
width: 100%;
height: 6px;
box-sizing: border-box;
bottom: 0;
border-top: 1px dotted #E91E63;
border-bottom: 2px solid #E91E63;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
padding: .3em;
border-bottom: 2px solid #64B5F6;
box-shadow:0px 4px 0px 0px #0D47A1;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title{
position: relative;
overflow: hidden;
padding: .3em;
}
.cp_h1title::before,
.cp_h1title::after{
content: "";
position: absolute;
bottom: 0;
}
.cp_h1title:before{
border-bottom: 4px solid #F4511E;
width: 100%;
}
.cp_h1title:after{
border-bottom: 4px solid #FFAB91;
width: 100%;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title{
border-bottom: solid 4px #4DD0E1;
position: relative;
padding: .3em 0;
}
.cp_h1title:after {
position: absolute;
content: " ";
display: block;
border-bottom: solid 4px #006064;
bottom: -4px;
width: 15%;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
position: relative;
padding: .3em;
}
.cp_h1title::before,
.cp_h1title::after {
content: '';
position: absolute;
bottom: -4px;
left: 0;
height: 4px;
}
.cp_h1title::before {
z-index: 2;
width: 15%;
background-color: #E91E63;
}
.cp_h1title::after {
width: 100%;
background: repeating-linear-gradient(45deg, #fff, #fff 2px, #E91E63 2px, #E91E63 4px);
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
position: relative;
padding: .3em;
border-bottom: 1px solid #7986CB;
}
.cp_h1title::after {
position: absolute;
bottom: -3px;
left: 0;
z-index: 2;
content: '';
width: 15%;
height: 5px;
background-color: #303F9F;
}
<h1 class="cp_h1title"><span>見出しテキスト</span></h1>
.cp_h1title{
padding: 0 0 2px 0;
background: linear-gradient(135deg, #1E88E5 0%,#039BE5 25%,#00ACC1 50%,#00897B 75%,#43A047 100%);
}
.cp_h1title span{
display: block;
padding: .3em;
background: #fafcfc;/*背景色と同じ色に*/
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title{
position: relative;
padding: .3em;
}
.cp_h1title:after {
content: "";
display: block;
height: 4px;
background: linear-gradient(to right, #E91E63, transparent);
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
position: relative;
padding-left: 25px;
}
.cp_h1title:before {
position: absolute;
content: '';
bottom: -4px;
left: 0;
width: 0;
height: 0;
border: none;
border-left: solid 15px transparent;
border-bottom: solid 15px #da3c41;
}
.cp_h1title:after {
position: absolute;
content: '';
bottom: -4px;
left: 10px;
width: 100%;
border-bottom: solid 4px #da3c41;
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
position: relative;
padding: .3em;
}
.cp_h1title:after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 4px;
background: repeating-linear-gradient(-45deg, #FF7043, #FF7043 2px, #fff 2px, #fff 4px);
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title {
background: linear-gradient(transparent 60%, #F8BBD0 60%);
}
<h1 class="cp_h1title">見出しテキスト</h1>
.cp_h1title{
position: relative;
padding: 4px 4px 10px 4px;
}
.cp_h1title:before{
content:'';
height:15px;
width: 100%;
display:block;
position:absolute;
bottom:13px;
left:0px;
background-color: rgba(144, 202, 249,1);
filter:alpha(opacity=50);
opacity:0.50;
box-shadow: 0px 3px 3px 3px rgba(144, 202, 249,0.5) inset;
}
CSS3などで新たに追加された要素・装飾方法など、日々コードを書いていないと忘れてしまったり、ささっとプロトタイプを作る時などちょっとしたことに時間をかけている暇はない。そんな時に「あ〜、あれストックしときゃよかったなぁ」って困った自分用のストックブログです。カスタマイズなどがしやすいよう、昨今のweb制作に取り入れられる一般的なコードを中心に掲載しています。
@copypet_jp More Info