Aligning line made with CSS [closed]

Not the cleanest or the best way but, you could simply use left:0; and right:0; to make the border 100% of the content, then wrap your text with another tag with position relative, z-index and add background to overlap the border.

Here a example: https://jsfiddle.net/23x380kh/

You can change the padding-right value to modify the spacing you want.