レコプラ

役立つ有益ブログ

wordpressテーマMesocolumnの見出しをカスタマイズ

568 views
約10分

当サイトはアフィリエイト広告を利用しています

wordpressテーマMesocolumnの見出しをカスタマイズ

今回は見出し設定について

newspaper-152320_640

初期値の場合は見出しが文字の大小だけで少し寂しいので素人なので苦戦しながら変更しました。

初期値のcssでは以下のようになっています。

.post-content h1 {font-size: 1.8em; margin: 0 0 1em; }
.post-content h2 {font-size: 1.7em;margin: 0 0 1em;}
.post-content h3 {
	font-size: 1.35em;
	margin: 0 0 1em;
}
.post-content h4 {font-size: 1.5em;margin: 0 0 1em;}
.post-content h5 {font-size: 1.35em;margin: 0 0 1em;}
.post-content h6 {font-size: 1em;margin: 0 0 1em;}

スタイルシート (style.css)より検索してください。

キーボードのCtrl+Fで【.post-content h1】と検索してください。

h1~h6までありますのでこれを変更していきます。

cssの変更

コピー&ペーストでも使えます。

見出しジェネレーターなどがありますのでお好きな設定に変更してください。

h1は

.post-content h1 {font-size: 1.8em; margin: 0 0 1em; }

これから以下へ差し替えました。

.post-content h1{
 color: #111;
 margin: 0 0 0.5em;
 border-bottom: 4px solid #EA3049;
 }
 
.post-content h1:first-letter{
padding:0.08em 0.1em 0.08em 0.1em;
margin-right:4px;
background:#F7E33E;
font-size:1.2em;
color:#111;
 
 }

 次は見出しh2の変更

初期は以下になっています。

.post-content h2 {font-size: 1.7em;margin: 0 0 1em;}

変更後は以下をコピペしてください。

カラーコードなど自分好みに変更すればOKです。

.post-content h2 {font-size: 1.5em;margin: 0 0 1em;}
.post-content h2 {
    position: relative;
    color: #ffffff;
    background: #da0f38;
    font-size: 16pt ;
    border: 3px solid #360200;
    margin: 10px 10px 23px 10px;
    padding: 10px 5px 10px 10px;
    border-radius: 3px;
    box-shadow:1px 3px 7px 0px  #666666 ;
}
.post-content h2:after, .sample2:before {
    content: "";
    position: absolute;
    top: 100%;
    height: 0;
    width: 0;
}
.post-content h2:after {
    left: 40px;
    border: 10px solid transparent;
    border-top: 10px solid #da0f38;
}
.post-content h2:before {
    left: 37px; 
    border: 13px solid transparent;
    border-top: 13px solid #360200;
}

 見出しh3の変更方法

初期は以下になっています。

.post-content h3 {
	font-size: 1.35em;
	margin: 0 0 1em;
}

これを変更します。

またコピペしてください。

.post-content h3 {
    position: relative;
    color: #ffffff ;
    background: #4ac6de;
    font-size: 12pt ;
    line-height: 1;
    margin: 20px -10px 20px -10px;
    padding: 10px 5px 10px 20px;
    box-shadow:1px 3px 7px 0px  #c1c1c1 ;
    border-top:3px solid #0f5660;
}
.post-content h3:after, sample2:before {
    content: "";
    position: absolute;
    top: 100%;
    height: 0;
    width: 0;
    border: 5px solid transparent;
    border-top: 5px solid #333;
}
.post-content h3:after {
    left: 0;
    border-right: 5px solid #333;
}
.post-content h3:before {
    right: 0;
    border-left: 5px solid #333;
}

 見出しh4の変更

引き続き初期コード

.post-content h4 {font-size: 1.5em;margin: 0 0 1em;}

変更後。

ここもコピペで使えます。

.post-content h4 {
	position:relative;
	padding:10px;
	background:#5b72e9;
	box-shadow:
		0 -10px 0 0 #95daff,
		10px 0 0 0 #5b72e9,
		-10px 0 0 0 #5b72e9,
		0 3px 3px 0 rgba(0,0,0,0.1);
}

h5,h6は設定していないので初期のままになっていますので省略します。

h1~h4の初期コードは

.post-content h1 {font-size: 1.8em; margin: 0 0 1em; }
.post-content h2 {font-size: 1.7em;margin: 0 0 1em;}
.post-content h3 {
	font-size: 1.35em;
	margin: 0 0 1em;
}
.post-content h4 {font-size: 1.5em;margin: 0 0 1em;}
.post-content h5 {font-size: 1.35em;margin: 0 0 1em;}
.post-content h6 {font-size: 1em;margin: 0 0 1em;}

完成後のコードはこうなっています。

.post-content h1{
    color: #111;
    margin: 0 0 0.5em;
    border-bottom: 4px solid #EA3049;
   }
 
.post-content h1:first-letter{
padding:0.08em 0.1em 0.08em 0.1em;
margin-right:4px;
background:#F7E33E;
font-size:1.2em;
color:#111;
 
    }
 

.post-content h2 {
    position: relative;
    color: #ffffff;
    background: #da0f38;
    font-size: 16pt ;
    border: 3px solid #360200;
    margin: 10px 10px 23px 10px;
    padding: 10px 5px 10px 10px;
    border-radius: 3px;
    box-shadow:1px 3px 7px 0px  #666666 ;
}
.post-content h2:after, .sample2:before {
    content: "";
    position: absolute;
    top: 100%;
    height: 0;
    width: 0;
}
.post-content h2:after {
    left: 40px;
    border: 10px solid transparent;
    border-top: 10px solid #da0f38;
}
.post-content h2:before {
    left: 37px; 
    border: 13px solid transparent;
    border-top: 13px solid #360200;
}

.post-content h3 {
    position: relative;
    color: #ffffff ;
    background: #4ac6de;
    font-size: 12pt ;
    line-height: 1;
    margin: 20px -10px 20px -10px;
    padding: 10px 5px 10px 20px;
    box-shadow:1px 3px 7px 0px  #c1c1c1 ;
    border-top:3px solid #0f5660;
}
.post-content h3:after, sample2:before {
    content: "";
    position: absolute;
    top: 100%;
    height: 0;
    width: 0;
    border: 5px solid transparent;
    border-top: 5px solid #333;
}
.post-content h3:after {
    left: 0;
    border-right: 5px solid #333;
}
.post-content h3:before {
    right: 0;
    border-left: 5px solid #333;
}
.post-content h4 {
	position:relative;
	padding:10px;
	background:#5b72e9;
	box-shadow:
		0 -10px 0 0 #95daff,
		10px 0 0 0 #5b72e9,
		-10px 0 0 0 #5b72e9,
		0 3px 3px 0 rgba(0,0,0,0.1);
}

参考にしたサイト

見出しのデザインをCSSのみでカスタマイズする(一部CSS3対応)

http://www.keni-customize.net/custom-midashi-design-555/

 

アクセントに使えるCSSのborderと擬似要素を使った立体的な見出しデザイン

http://squeeze.jp/blog/web-design/heading-design-border-css/

サイト自体も凄くおしゃれに作られています。

 

wordpressって先生だらけでいいですね。

参考や勉強になることばかりです。

http://www.hotnews-planet.com/

この記事を書いた人

この記事を書いた人:ゆうき

中小企業DX化コンサルタント × システム開発者
1987年生まれ / 高卒スタートから中小物流会社の業務改善責任者へ。

「大手コンサルを使わず、現場の泥臭いアナログ環境からシステム化を推進する」をモットーに活動。18年間の実務経験と、最新のAI(ClaudeやChatGPT)を組み合わせた「現場で本当に使える」確かなノウハウを発信しています。

分野と強み(Experience/Expertise)

  • 物流・DX化の最前線(歴18年):デジタルのない環境からIT化の全工程を実践。15社へのシステム導入で成功率99%、年間労働時間を35%削減。
  • AI・システム実務活用:ClaudeやChatGPT、バイブコーディング技術を駆使し、最新ITを机上の空論ではなく「現場の成果」に変換。(累計5,000万円以上のコスト削減実績)
  • 本業の知見を活かした副業展開:採用代行(成功率85%向上)やコンテンツ制作の手法を横展開し、個人でも最高月収35万円を達成。

読者へのお約束(Trustworthiness)

当ブログでは、18年間にわたる失敗と成功の実体験、そして自腹での検証に基づき、「実際に使って役立った情報・安全に稼げたノウハウ」だけを忖度なしで発信します。机上の空論ではないリアルな解決策で、あなたのビジネスや副業を支援します。

お問い合わせ:info @desire-planet.com

ロリポップ!なら大人気のWordpressも簡単インストール!
あなたもWordPressでブログデビューしちゃおう!!




Leave A Reply

*
*
* (公開されません)

認証コード *

Share / Subscribe
Facebook Likes
Posts
Hatena Bookmarks
Pinterest
Pocket
Evernote
Feedly
Send to LINE