CSS 兩邊是線 中間是文字的效果


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

<!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>

  代碼中的小星星可以在阿里字體圖標庫中下載一個 試試 ,應該沒問題


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM