I'm not sure if this works in all browsers, but I believe that hr takes up all the space that you provide to it. Therefore, you can give it a large negative left edge and place it in a centered div. Instead of the hr element, you can also use an empty div, which may or may not be easier to use. You can set the border-top style of this div to a wider range of border types (like a dot).
<div id="content"> <hr id="bar" /> <div id="realcontent"> Something here </div> </div>
With CSS:
#content { width: 400px; margin: auto; color: white; } #bar { margin-left: -1000px; margin-bottom: 5px; background: blue; } #realcontent { background-color: #000000; }
source share