はてなブログのサイドバータイトルデザインのカスタマイズ集を作ってみました。
はてなブログではそのままコピペでお使いいただけます。WordPressや他のブログサービスでもセレクタを変えればお使いいただけます。
注意 文字色について(全共通)
サイドバータイトルの文字色が変わらないときはaタグの文字色もご指定下さい。.hatena-module-title a { color: #47a89c;/* 文字色 */ }
シンプル
色変更 フォント変更
シンプルに文字のみで色やフォントのアピールできます。
/* サイドバータイトル */ .hatena-module-title { position: relative; color: #47a89c;/* 文字色 */ font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ margin-bottom: 15px;/* 下余白 */ padding: .25em 0 .25em 0; font-family: 'Lucida Grande', 'segoe UI', Verdana, Arial, sans-serif;/* フォント指定 */ }
背景色あり
フォント指定など不要な場合は削除して下さい。
/* サイドバータイトル */ .hatena-module-title { position: relative; color: #fff;/* 文字色 */ background-color: #47a89c;/* 背景色 */ font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ margin-bottom: 15px;/* 下余白 */ padding: .5em 0 .5em 1em;/* 左内余白1em */ font-family: 'Lucida Grande', 'segoe UI', Verdana, Arial, sans-serif;/* フォント指定 */ }
下線あり
/* サイドバータイトル */ .hatena-module-title { position: relative; color: #47a89c;/* 文字色 */ font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ margin-bottom: 15px;/* 下余白 */ padding: .25em 0 .25em 0; font-family: 'Lucida Grande', 'segoe UI', Verdana, Arial, sans-serif;/* フォント指定 */ border-bottom: 1px solid #47a89c;/* 下線 */ }
下線あり(ダブル)
/* サイドバータイトル */ .hatena-module-title { position: relative; color: #47a89c;/* 文字色 */ font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ margin-bottom: 15px;/* 下余白 */ padding: .25em 0 .25em 0; font-family: 'Lucida Grande', 'segoe UI', Verdana, Arial, sans-serif;/* フォント指定 */ border-bottom: 4px double #47a89c;/* 下線 */ }
左右に直線を重ねるデザイン
/* サイドバー 直線重ねる */ .hatena-module-title { color: #555; font-size: 120%;/* 文字サイズ */ position: relative; text-align: center; display: -webkit-flex; display: flex; padding: 0; margin-bottom:15px; align-items: center; } .hatena-module-title::before, .hatena-module-title::after { content: ''; flex-grow: 1; background-color:#555; height: 1px; } .hatena-module-title::before { margin-right: .5em; } .hatena-module-title::after { margin-left:.5em; }
アイコン付き
FontAwesome
FontAwesomeを使用する際まだ読み込んでいないときは以下をフッタに追加して下さい。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
/* サイドバータイトル */ .hatena-module-title { position: relative; color: #47a89c;/* 文字色 */ font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ margin-bottom: 15px;/* 下余白 */ padding: .25em 0 .25em .5em; font-family: 'Lucida Grande', 'segoe UI', Verdana, Arial, sans-serif;/* フォント指定 */ border-bottom: 4px double #47a89c;/* 下線 */ } .hatena-module-title::before { content:"\f219"; font-family: FontAwesome; }
はてなブログのblogicon
はてなブログのblogiconを使うこともできます。(読み込み不要)
/* サイドバータイトル */ .hatena-module-title { position: relative; color: #47a89c;/* 文字色 */ font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ margin-bottom: 15px;/* 下余白 */ padding: .25em 0 .25em .5em; font-family: 'Lucida Grande', 'segoe UI', Verdana, Arial, sans-serif;/* フォント指定 */ border-bottom: 4px double #47a89c;/* 下線 */ } .hatena-module-title::before { content:"\f004"; font-family: blogicon; }
ガーリーデザイン
リボン風
/* サイドバータイトル リボン */ .hatena-module-title { position: relative; color: #555; font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ height: 40px; line-height: 40px; padding: 0.2em 0.5em; background-color: #d2e7e4; box-shadow: 0px 0px 0px 5px #d2e7e4; border: 1px dashed #fff; margin-bottom: 15px;/* 下余白 */ } .hatena-module-title::before, .hatena-module-title::after { content: ''; position: absolute; border-style: solid; border-color: transparent; } .hatena-module-title::before { top: 54px; left: -6px; border-width: 0 15px 15px 0; border-right-color: #a8d4ff; }
レース風
/* サイドバー レース風 */ .hatena-module-title { color: #555; font-size: 120%;/* 文字サイズ */ font-weight: bold;/* 太字 */ position: relative; padding: 0.2em 0.5em; background-color: #d2e7e4; box-shadow: 0px 0px 0px 5px #d2e7e4; border-top: 1px dashed #fff; border-bottom: 1px dashed #fff; margin-bottom: 15px;/* 下余白 */ }
アイコン画像を使う
↑の例では背景画像はbodyに指定しています。
.hatena-module-title { position: relative; padding-left: 50px; line-height: 1.4; font-size:130%;/* 文字サイズは適宜調整 */ } .hatena-module-title::before { content: url(画像URL); position: absolute; font-size: 1em; left: 0; top: -9px; }
画像を使ったCSSのカスタマイズは以下の記事もご参照下さい。
blog.minimal-green.com
ポップ系

左ライン
/* サイドバー 左ライン */ .hatena-module-title { color: #555; font-size: 120%;/* 文字サイズ */ padding: .5em 0 .5em .75em; border-left: 7px solid #77B8DA;/* 左横ボーダー */ background-color:#edf5f4; margin-bottom: 15px;/* 下余白 */ }
ストライプ背景
/* サイドバー ストライプ */ .hatena-module-title { color: #555; font-size: 120%;/* 文字サイズ */ padding: .5em 0 .5em .75em; border-left: 5px solid #77B8DA;/* 左横ボーダー */ background: repeating-linear-gradient(90deg, #edf5f4, #edf5f4 10px, #f6faf9 0, #f6faf9 20px); margin-bottom: 15px;/* 下余白 */ }
吹き出し
/* サイドバー 吹き出し */ .hatena-module-title { color: #555; font-size: 120%;/* 文字サイズ */ position: relative; padding: .5em 0; background-color: #fff; border: 2px solid #77B8DA; border-radius: 6px; text-align:center; margin-bottom: 15px;/* 下余白 */ } .hatena-module-title::before, .hatena-module-title::after { position: absolute; top: 100%; left: 50%; content: ''; height: 0; width: 0; border: 10px solid transparent; margin-left: -10px; } .hatena-module-title::before { border-top: 15px solid #77B8DA; } .hatena-module-title::after { margin-top: -2px; border-top: 15px solid #fff; }
基本
中央寄せ
.hatena-module-title { text-align: center; }
左寄せ
.hatena-module-title { text-align: left; }
リセット
テーマのサイドバーデザインをリセットするには以下のリセット用CSSを先に記述し、その後に設置したいデザインのCSSを改定ください。
/* サイドバータイトル */ .hatena-module-title { position: relative; background-color:transparet; border: none; } .hatena-module-title::before, .hatena-module-title::after { content: none; }
サイドバータイトルのテキストを画像に置換する
プロフィール、最新記事などを個別に画像で作って置換するには以下のようにclass指定を追加して下さい。
主なセレクタは書いていますが、個別ではChromeの検証ツールなどで調べて下さい。
/* サイドバー 画像置換 */ /* プロフィール */ .hatena-module-profile .hatena-module-title { margin: 0 0 15px; padding: 0; height: 40px;/* 画像の高さ */ line-height: 40px;/* 画像の高さ */ background-image: url(画像URL); background-repeat: no-repeat; background-position: center; text-indent: -9999px;/* テキスト飛ばす */ } /* 最新記事 */ .hatena-module-recent-entries .hatena-module-title { margin: 0 0 15px; padding: 0; height: 40px;/* 画像の高さ */ line-height: 40px;/* 画像の高さ */ background-image: url(画像URL); background-repeat: no-repeat; background-position: center; text-indent: -9999px;/* テキスト飛ばす */ } /* 月別アーカイブ */ .hatena-module-archive .hatena-module-title { margin: 0 0 15px; padding: 0; height: 40px;/* 画像の高さ */ line-height: 40px;/* 画像の高さ */ background-image: url(画像URL); background-repeat: no-repeat; background-position: center; text-indent: -9999px;/* テキスト飛ばす */ } /* Link */ .hatena-module-links .hatena-module-title { margin: 0 0 15px; padding: 0; height: 40px;/* 画像の高さ */ line-height: 40px;/* 画像の高さ */ background-image: url(画像URL); background-repeat: no-repeat; background-position: center; text-indent: -9999px;/* テキスト飛ばす */ } /* 検索 */ .hatena-module-search .hatena-module-title { margin: 0 0 15px; padding: 0; height: 40px;/* 画像の高さ */ line-height: 40px;/* 画像の高さ */ background-image: url(画像URL); background-repeat: no-repeat; background-position: center; text-indent: -9999px;/* テキスト飛ばす */ } /* カテゴリー */ .hatena-module-category .hatena-module-title { margin: 0 0 15px; padding: 0; height: 40px;/* 画像の高さ */ line-height: 40px;/* 画像の高さ */ background-image: url(画像URL); background-repeat: no-repeat; background-position: center; text-indent: -9999px;/* テキスト飛ばす */ }
以上はてなブログで使えるサイドバーデザインのカスタマイズ集をご紹介しました。
関連記事: