wordpress のテーマは sydney の小テーマを使っています。
付随の css エディターで
h2 {
font-size: 24px;
padding: 0.6em 0em;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
margin-top: 3em;
margin-bottom: 1em;
background-color:rgba(44,153,181,.04)
}
としても、どういうわけか margin-top が効きません。
css にも優先度があるようですが、sydney の style.css を書き換えることによって margin-top が効くようになりました。
1750行あたりにある、以下の部分の一番上をコメントアウトするようです。
/*body:not(.elementor-page):not(.panel-layout) .entry-content h2,*/
body:not(.elementor-page):not(.panel-layout) .entry-content h3,
body:not(.elementor-page):not(.panel-layout) .entry-content h4,
body:not(.elementor-page):not(.panel-layout) .entry-content h5,
body:not(.elementor-page):not(.panel-layout) .entry-content h6 {
margin-top: 1.2em;
margin-bottom: 0.5em;
}
この設定は sydney の親テーマが更新されるたびにリセットされるようで、そのたびに書き換える必要があるようです。