HOME > CSS > 文字(タイトル)の両脇に短い横線をひく

文字(タイトル)の両脇に短い横線をひく

ソース

<div class="bdTtl">タイトル</div>
.bdTtl {
display: flex;
align-items: center;
justify-content: center;  //全幅で線を引く場合は不要。
}
.bdTtl:before,
.bdTtl:after {
border-top: 1px solid;
content: "";
flex-grow: 1; //全幅で線を引く場合。widthで線幅を短くしたい場合は不要もしくは0(初期値が0だから)
width:5em; //全幅で線を引く場合は不要。
}
.bdTtl:before {
margin-right: 1rem;
}
.bdTtl:after {
margin-left: 1rem;
}

サンプル

文字(タイトル)の両脇に短い横線をひく

参考サイト


    Warning: Undefined array key "HTTP_REFERER" in /home/xs241045/ridesign.jp/public_html/lib/wp/wp-content/themes/libridesign2017/single-post.php on line 54

Warning: Undefined array key "HTTP_REFERER" in /home/xs241045/ridesign.jp/public_html/lib/wp/wp-content/themes/ridesignjp2016/relatedLinks.php on line 10