W3.org (the official specification) says that the value for the bordershorthand property is as follows:
<line-width> || <line-style> || <color>
Thus, it indicates that the order you should use is width, style, color. In other words, border: 2px solid red;from your example.
The other method is technically "undefined", but browsers usually display it correctly because there is no confusion between style and color values; there is currently no color called βsolidβ or βdottedβ. In any case, stick to the official method.