Outline radius?

Marc Guerin picture Marc Guerin · Mar 22, 2011 · Viewed 355.9k times · Source

Is there anyway of getting rounded corners on the outline of a div element, similar to border-radius?

Answer

Lea Hayes picture Lea Hayes · Jul 25, 2011

Old question now, but this might be relevant for somebody with a similar issue. I had an input field with rounded border and wanted to change colour of focus outline. I couldn't tame the horrid square outline to the input control.

So instead, I used box-shadow. I actually preferred the smooth look of the shadow, but the shadow can be hardened to simulate a rounded outline:

 /* Smooth outline with box-shadow: */
    .text1:focus {
        box-shadow: 0 0 3pt 2pt red;
    }

    /* Hard "outline" with box-shadow: */
    .text2:focus {
        box-shadow: 0 0 0 2pt red;
    }
<input type=text class="text1"> 
<br>
<br>
<br>
<br>
<input type=text class="text2">