Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it better to specify border-radius in percentages for circle borders?

Tags:

css

In general, is it more efficient to use percentages or pixel/em values for border-radii?

For an example: for a square image 200px by 200px, which out of border-radius:50% or border-radius:100px is best? Obviously percentages for circles are easier to manage, but are percentages significantly harder to calculate? Are there any caveats?

This question is assuming the use of a compatible browser, and static-sized images.

like image 835
Alexander Mistakidis Avatar asked Mar 20 '14 22:03

Alexander Mistakidis


People also ask

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.

Should I use border radius REM?

It is generally safest to use the same unit for different dimensions, and this applies to border-radius , too, when the height and width of the element have been set in rem units. The reason is that this ensures that the shape is preserved if the font size of the root element is changed.

Which value of borders radius property is set to create a circle?

To create a circle we can set the border-radius on the element. This will create curved corners on the element. If we set it to 50% it will create a circle.


1 Answers

I prefer to user percentage values because if I change size of my image, I don't need change my border-radius. But in MDN site you can read this bugs about percentage value:

percentage values

  • are not supported in older Chrome and Safari versions (it was fixed in Sepember 2010)
  • are buggy in Opera prior to 11.50
  • are implemented in a non-standard way prior to Gecko 2.0 (Firefox 4). Both horizontal and vertical radii were relative to the width of the border box.
  • are not supported in older versions of iOS (prior to 5) and Android versions (prior to WebKit 532)

Check this link for more info: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius#_values

like image 118
Parhum Avatar answered Oct 22 '22 19:10

Parhum