Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outline radius?

Tags:

html

css

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

like image 491
Marc Guerin Avatar asked Mar 22 '11 16:03

Marc Guerin


People also ask

Is there outline radius?

The outline-radius property is used to specify the radius of an outline. It is used to give rounded corners to outlines. This property can only be used in Firefox2-87 (till march 2021) and from Firefox 88, outline-property follows the shape created by border-radius automatically, so this property is no longer needed.

What does border radius mean?

The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.

What is the best border radius?

3–4px Radius: This is best and probably the most safe choice. 3–4px is in every point of standard across multi fields, expressing a little bit more friendly and accommodating then 0px.

How do you calculate border radius?

The border radius of the outer element should be equal to the sum of the border radius of the inner element and the distance between the two elements. This can be mathematically expressed as innerRadius + distance = outerRadius or more tersely R1 + D = R2 .


1 Answers

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:

input, input:focus {     border: none;     border-radius: 2pt;     box-shadow: 0 0 0 1pt grey;     outline: none;     transition: .1s; } /* Smooth outline with box-shadow: */ .text1:focus {     box-shadow: 0 0 3pt 2pt cornflowerblue; }  /* Hard "outline" with box-shadow: */ .text2:focus {     box-shadow: 0 0 0 2pt red; }
<input class="text1">  <br> <br> <input type=text class="text2">
like image 105
Lea Hayes Avatar answered Oct 01 '22 14:10

Lea Hayes