【 HTML 】
<h2 class="moji1"><span>見出し</span></h2>
【 CSS 】
.moji1{position:relative;}
.moji1 span{
position: absolute;
top: 0;
left: 0;
display: block;
color: #000;
white-space: nowrap;
}
.moji1 span::before{
content: "";
display: inline-block;
width: 3em;
border-top: 1px solid;
vertical-align: middle;
margin-right: 1em;
padding-bottom:4px;
}
https://pa-tu.work/blog/heading-under-line
【 HTML 】
<h2 class="sme-animation-fade-in moji" data-sme-animation-delay="0.2" data-sme-animation-duration="0.6"><span>介護業界で外国人を雇う際の制度比較</span></h2>
【 CSS 】
.moji{
font-size:2em;
background:url(https://f.takinoo.com/wp-content/plugins/my-snow-monkey/img/h2-bg.png);
background-repeat:no-repeat;
padding-left:100px!important;
}
}
@media screen and (max-width: 481px) {/*mobi*/
.moji{
background:url(https://f.takinoo.com/wp-content/plugins/my-snow-monkey/img/h2-bg-mobi.gif);
background-repeat:no-repeat;
padding-left:50px!important;
}
}
.moji span{
background-color:#FFFFFF!important;
padding-left:10px;
}
既存の「見出し」でOK
【 CSS 】
.moji2{
width:1100px!important;
font-size:2em;
background-image:url(https://f.takinoo.com/wp-content/plugins/my-snow-monkey/img/h2-icon.png);
background-repeat:no-repeat;
padding-left:40px!important;
display: flex;
align-items: center;
}
.moji2:after {
content: "";
height: 1px;
flex-grow: 1;
background-color: #666;
}
.moji2:after {
margin-left: 1rem;
}
@media screen and (max-width: 481px) {/*SP*/
.moji, .moji2{font-size:1.6em;}
/*.moji3{font-size:1.4em;}*/
.moji2{
background-image:url(https://f.takinoo.com/wp-content/plugins/my-snow-monkey/img/h2-icon-mobi.png);
}
}
2色罫線
WP内のh2タグ指定のみで大丈夫!
/*--------------------
見出しの装飾
---------------------*/
.titledeco1 {
position: relative;
padding: 1rem 0rem!important;
border-bottom: 3px solid #116587!important;
color:#146789!important;
}
.titledeco1:before {
position: absolute;
bottom: -3px;
left: 0;
width: 20%;
height: 3px;
content: '';
background: #49a9d0;
}
※罫線太バージョン
.titledeco1 {
position: relative;
padding: 1rem 0rem!important;
border-bottom: 6px solid #116587!important;
color:#146789!important;
}
.titledeco1:before {
position: absolute;
bottom: -6px;
left: 0;
width: 20%;
height: 6px;
content: '';
background: #49a9d0;
}
※通常のh2タグ見出しでOK
.moji1{
position: relative;
display: inline-block;
margin-bottom: 1em;
font-size:2em;
font-weight:normal!important;
}
/*以下で線を表示*/
.moji1:before {
content: '';
position: absolute;
left: 0;
top: -15px;/*線の上下位置 bottomで下*/
display: inline-block;
width: 70px;/*線の長さ*/
height: 2px;/*線の太さ*/
background-color: #8c0f00;/*線の色*/
border-radius: 2px;/*線の丸み*/
}
下線を中央に
.moji2{
position: relative;
padding: 1.5rem;
text-align: center;
font-size:2.5em!important;
font-weight:normal!important;
color:#725128!important;
}
.moji2:before {
position: absolute;
bottom: -10px;
left: calc(50% - 30px);
width: 70px;
height: 2px;
content: '';
border-radius: 2px;
background: #c7b299;
}
※通常のh2タグ見出しでOK
※左寄せの場合は
left: 50%;
transform: translateX(-50%);
削除
.moji5 {
position: relative;
line-height: 1.4!important;
padding:0.25em 1em!important;
display: inline-block!important;
top:0!important;
left: 50%;
transform: translateX(-50%);
}
.moji5:before, .moji5:after {
position: absolute;
top: 0;
content:'';
width: 8px!important;
height: 100%!important;
display: inline-block!important;
}
.moji5:before {
border-left: solid 1px #FFFFFF;
border-top: solid 1px #FFFFFF;
border-bottom: solid 1px #FFFFFF;
left: 0;
}
.moji5:after {
content: '';
border-top: solid 1px #FFFFFF;
border-right: solid 1px #FFFFFF;
border-bottom: solid 1px #FFFFFF;
right: 0;
}