I'm having some trouble with borders on iOS (safari).
I have an image (my gravatar) which I want to give a round border which is 10px solid and white.
To achieve this I have the HTML
<img src="http://2.gravatar.com/avatar/b7c2d49748426791dc98b8214dfac9d1?s=500" class="img-circle" height="300" width="300">
and the CSS
.img-circle {
-webkit-border-radius: 500px;
-moz-border-radius: 500px;
border-radius: 500px;
border: solid 10px white;
}
JSFiddle http://jsfiddle.net/2UT8v/2/
I'm using twitter's bootstrap and so the border-radius is being specified by their class .img-circle (that is why the radius is 500px) and then I've added the border weight and color.
This works well on a desktop browser (Chrome) but when viewing on iOS (safari on my iPad) it shows the 10px solid white border is still a square around the original image and the radius is applied after and so cuts off some of the border.
Does anybody know how I can get the border to follow the radius in iOS?
CSS Syntaxborder-radius: 1-4 length|% / 1-4 length|%|initial|inherit; Note: The four values for each radius are given in the order top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted it is the same as top-right. If bottom-right is omitted it is the same as top-left.
The border-radius property in WebKit accepts one or two values and uses them to style all four corners making a nice symmetric shape. The new Firefox syntax allows you to define four different round or elliptical corners. A slash has been introduced to separate the horizontal and vertical length settings.
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.
Border Radius in React NativeThe borderRadius property can be set as the style attribute to any element. It takes a value in pixels and assigns that value to the overall border radius of that UI element. By default, the border radius of any element is 0 if you haven't added that style attribute to that element.
Quick and dirty solution: http://jsfiddle.net/mEZEj/ Use box-shadow
instead of border
.
Clean solution: http://jsfiddle.net/TjUum/ Use a block div
element with the avatar as the background-image
. Adjust as needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With