Check out this article. They recommend that you do this in the same way as your HR, but instead use the http://www.sitepoint.com/rainbow-border-with-sass/ pseudo-elements.
This can be done with a border image, but it has limited support ( http://caniuse.com/border-image ). If you are interested in this approach, check out this code handle - http://codepen.io/samarkandiy/pen/lvrBn
Here is what I designed to show you how it can work - http://jsfiddle.net/29gPg/
.border { background-color: black; background-size: 50px 50px; display: inline; float: left; margin: 15px; position: relative; border-width: 20px; width: 160px; height: 160px; } .border { border-image: linear-gradient(90deg, #9b59b6 0%, #9b59b6 25%, #34495e 25%, #34495e 50%, #f1c40f 50%, #f1c40f 75%, #e67e22 75% ) 2%; border-top-width: 10px; border-bottom: 0px; border-left: 0px; border-right: 0px; }
One final thought, if you plan to use CSS to change this border on the fly, the CSS should be on the line, otherwise you will have to create a bunch of gradient gradient CSS images first, and then apply them through the class name.
Edit - a border image is used, but only works in WebKit (maybe ie11, but not tested)
This question reached its interest, so I went ahead with a JSFiddle demo. http://jsfiddle.net/K2FEm/5/
Edit 2So, it would seem that the border image is not supported by FF at all, or at least it does not use gradients, as shown here - http://css-tricks.com/examples/GradientBorder/ .
However, there is a trick that you can use to use the same gradient (this time with the corresponding browser prefix) as the background image and position it correctly. You can see the results in this script below, if you want to set different colors, you will either have to write a script in JS / JQuery to dynamically build the gradients, and then apply them to the elements in the line or do as I am and do it beforehand certain classes, which can then be applied at will (this is usually the preferred method for speed and memory, but you can go with the first option for convenience).
I built my first gradient manually and then got all the browser prefixes using http://www.colorzilla.com/gradient-editor/ (This is a great tool that I use all the time.)
Demo