直接上代码

<style type="text/css">
	.title {
	  position: relative;
	  font-size: 32px;
	  color: #fff;
	  height: 45px;
	  line-height: 45px;
	  text-align: center;
	  top: 60px;
	}
	.title:before {
	  content: "";
	  position: absolute;
	  width: 28px;
	  height: 2px;
	  top: 50%;
	  background-color: #fff;
	  left: 42%;
	}
	.title:after {
	  content: "";
	  position: absolute;
	  width: 28px;
	  height: 2px;
	  top: 50%;
	  background-color: #fff;
	  right: 42%; 
	}
</style>

<div class="title">标题</div>

效果如下图

css实现标题左右横线-冯金伟博客园