剛開始做的時候 想了一下 這個是怎么做出來的,后來在網上看到有個類似的效果,研究一下

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>兩根線中間有文字的實現</title>
<link rel="stylesheet" href="iconfont/iconfont.css">
<style>
.dv1 {
width:327px;
height: 22px;
position: relative;
margin:100px auto;
}
.liner {
width:100%;
height:1px;
background-color: #ccc;
position: relative;
top:50%;
}
.dv2 {
text-align:center;
width:120px;
height:22px;
line-height: 22px;
margin:0 auto;
background-color: #fff;
position: relative;
z-index:3;
}
.icon-star {
font-size:22px;
color:red;
margin-right:10px;
}
</style>
</head>
<body>
<div class="dv1">
<div class="liner"></div>
<div class="dv2">
<i class="iconfont icon-star"></i>
<span>熱門推薦</span>
</div>
</div>
</body>
</html>
代碼中的小星星可以在阿里字體圖標庫中下載一個 試試 ,應該沒問題
