You can do this with the pseudo element :
<div id="content">
<h2>Example title</h2>
<p>.. content ..</p>
<p>.. content ..</p>
<h2>Example longer title</h2>
<p>.. content ..</p>
<p>.. content ..</p>
</div>
CSS
#content {
position:relative;
width:500px;
margin:0 auto;
}
h2 {
display:inline-block;
background:#fff;
padding-right:20px;
line-height:1.2em;
}
h2:after {
content:"";
position:absolute;
margin-top:0.6em;
width:100%;
left:0;
height:2px;
background:blue;
z-index:-1;
}