カテゴリー︎: 【CSS】
なんか思い出した
cssでテキストの両端に線をつけるプチ技
これといった解説はありません
急ぎの方はさくっとコピペして使ってくださーい
実際はこんな感じになるはず
↓
テキストの両端に線をつける技
お好みで調整してくさいね
ソースコード
↓
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<style>
.txt_line {
background: tan;
font-size: 18px;
width: 100%;
margin: 0 auto;
height: 60px;
line-height: 60px;
display: inline-block;
position: relative;
left: 50%;
transform: translate(-50%);
text-align: center;
color: red;
}
.txt_line:before {
content: '';
position: absolute;
top: 50%;
display: inline-block;
width: 20%;
height: 1px;
background-color: red;
left: 0;
}
.txt_line:after {
content: '';
position: absolute;
top: 50%;
display: inline-block;
width: 20%;
height: 1px;
background: red;
right: 0;
}
@media only screen and (max-width: 769px){
.txt_wrap {
width: 80%;
margin: 0 auto;
padding: 0 8%;
}
}
</style>
<div class="txt_wrap">
<p class="txt_line">テキストの両端に線をつける技</p>
</div>
</body>
</html>