• CSS3 PREVIEW
  • MODULE STATUS
  • CSS SELECTORS TEST

2007 19 Jun

by Peter Gasston

Posted in CSS3 Previews , Declarations , Modules , W3C

  • Add comments (80)
  • Permanent link

With the release of Safari 3, there are now two browsers with (browser-specific) implementations of border-radius ; unfortunately, the two implementations are different. The problem is that there is an unresolved ambiguity in the CSS 3 working draft .

The draft proposes four declarations, which describe the four corners of a block:

Each of them should accept two values, which define the radii of a quarter ellipse that defines the shape of the corner ; this allows for irregular curves (take a look at the diagram in the draft if you need clarification, or see this example of a box with border-radius: 5px 20px , horribly rendered in Safari for Windows ).

Safari, with the prefix -webkit- , accepts these. Mozilla, with the prefix -moz- (and differing declarations ), accepts only a single value and, therefore, only regular curves.

At first glance, it would appear that Mozilla are in the wrong; however, their implementation is due to the ambiguity I mentioned earlier.

This ambiguity comes about in the border-radius shorthand property; if you enter a double value in this you’d expect to apply the irregular curves to all four corners:

If you wanted to have four different irregular curves on the box, you’d have to provide eight values to the declaration:

But what if you wanted to have two corners with one value, and two corners with a different value?

The problem is that this could be confused for four corners with regular curves. In order to get around this, you’d still have to provide eight values:

In fact, from the brief testing I’ve done (and I can’t find any documentation), it seems you can’t do any of that; unless I’m missing something, the shorthand declaration in Safari accepts only 1 or 2 values, to provide either regular or irregular curves which are applied to all four corners. If you want different irregular corners, you have to supply values to all four declarations:

Mozilla avoid this by going against the spec and allowing only regular curves; so you can provide 1, 2, 3 or 4 values and it’s all perfectly clear.

This problem is down to interpretation of the draft. I personally think Mozilla’s non-standard solution is better – it’s less flexible, but easier to understand – but can’t blame the Safari team for following the standard in their implementation.

It will be interesting to see which comes out on top; in the meantime, if you want to use border-radius in your code the only way to get them to appear the same on both browsers is with a single value for four regular corners:

You can skip to the end and leave a response.

' src=

Good piece Peter :) have you, by any chance, tested how Konqueror behaves with this as well?

' src=

I’ve read that Konqueror supports -khtml-border-radius, but can’t find any official confirmation, and can’t get it to work.

' src=

Could you attach a screenshot of such a irregular curve ?

I’ve added an example of -webkit-border-radius: 5px 20px to the post; I have to say, the rendering is horrible. I’m not sure if that’s because it’s Safari for Windows, perhaps someone with an OS X version could try?

' src=

Maybe it’s an idea to add a character like / to the value, like in font . So what’s before the character is the X radius, and after the character is the Y radius. If the character isn’t used, the value will be for both the X and Y radius. So now you can have something like this:

border-radius: 5px/20px 10px/5px 10px/20px 20px/5px;

Good idea, Arjan; a slash or a comma, like font-family uses:

border-radius: 5px 20px, 20px, 10px 20px, 20px;

I wonder if irregular curves are the way to go, however; the current implementation in Safari is horrible, whereas regular curves come out looking really nice.

' src=

Just to clarify, you *can* get identical rendering on WebKit and Gecko with a different radius on each corner. You just have to use the individual properties like -webkit-border-top-left-radius and -moz-border-radius-topleft . I’ve been using that technique to create tabs with rounded corners since I started playing with WebKit nightlies a few months ago.

And after messing around with that irregular-corner code, I think the reason it looks bad is that the smaller radius of 5px is the same width as the border. If you use a narrower border, like 1px or 2px, or if you use the 5px border with 20px and 40px for the radius, it looks fine.

' src=

CSS3 gathering speed……

over at CSS3, Paul Gasston has been diligently track the adoption and implementation of all things CSS3. His latest post concerning rounding corners highlights the frustration……

Diferencias entre el uso de border-radius en safari 3 y mozilla…

Un artículo acerca del diferente tratamiento que se ha dado a la propiedad border-radius en Safari 3 y Mozilla. Por lo visto viene de una mala intepretación de la especificación…

[…] Originally posted on CSS3.info. […]

' src=

Safari on Mac OS X renders exactly the same. But I do agree with Kelson, if the border size isn’t the same as the minor size, it looks much better.

' src=

Hmm, confusing. Though, I don’t see a problem with forcing the shorthand declaration to only take 4 values (one for each corner, regular only) whilst allowing non-regular corners with the individual declarations; it wouldn’t be the first shorthand property to not allow every aspect to be specified at once.

How can you say that screenshot from Safari is horribly rendered? It’s not as good as it should be, sure, but Firefox makes border-radius look like ass… It’s much better to avoid it at the moment, if you’re targetting FF, as it looks really pixellated and awful. See my work in progress (link below) and compare the beautiful rendering in Safari to FF’s piss-poor attempt.

I say stick with images till this stuff gets sorted out.

I think the inside of that border IS rendered horribly, but I’m sure if you matched the internal colour to the border it would look great.

Firefox 3’s corner rendering is better than FF2’s, judging by the preview I’ve been playing with.

It probably is safer to stick to images until this gets sorted out, I agree; although, it would be better if we could have multiple background images!

' src=

There’s another difference between the two that you haven’t brought up. If you apply a background picture to e.g. add some depth to what you’re making, Mozilla won’t clip it, so you’ll end up with square corners. Safari does the logical thing and applies the border radius to the background image as well.

It’s acknowledged in their bug database, but if it’s time to fix it for FF3 is another matter.

https://bugzilla.mozilla.org/show_bug.cgi?id=24998

Peter: I believe you’re right on that one, the outside is better than the inside, but it’s still not perfect. I don’t test against/use FF3 at all, so that’s cool if it is indeed better.

I suppose this kind of thing is the peril of playing with pre-spec stuff, but it does rather take the p**s that in 2007 we still can’t make a box with pretty rounded corners programmatically.

Meanwhile, Safari has apparently supported multiple background images since the dawn of time (well, for ages, anyway) – although I only found out a few weeks ago.

' src=

you *can* get identical rendering on WebKit and Gecko with a different radius on each corner. You just have to use the individual properties like -webkit-border-top-left-radius and -moz-border-radius-topleft.

Kelson – what do you do for Opera ?

@Anjanesh: You don’t. Opera has no border-radius implementation at the moment.

' src=

Prince also supports the border-radius properties, accepting two values on each.

' src=

Interesting article and certainly shows that CSS3 could become unnecessarily complicated and I’d tend to agree with Mozilla’s interpretation of the spec.

There’d also be the option of using border-image once this has been more widely adopted for any complicated irregular borders.

[…] border-radius: Safari vs Mozilla July 17th, 2007 — mozienigma border-radius: Safari vs Mozilla […]

' src=

For what it’s worth, Mozilla has implemented -moz-border-radius since before it was in any css3 draft (see cvs history ; note revisions 3.59 and 3.98). The first W3C draft I could find with border-radius was much later. I don’t recall if the differences between them are simply the editor’s preference or whether the working group has actually discussed which is preferable.

' src=

I’d just like to note that thanks to this discussion the CSSWG has adopted Mozilla’s shorthand syntax. :)

[…] our discussion of the inherent ambiguity in the border-radius declaration, it has been decided that the simpler syntax used by Mozilla will used for the shorthand; that is, […]

[…] κάποιο τρόπο να τα αντικαθιστά και τα 2 με ένα query λόγω ασυμβατότητας μεταξύ των implementations του κάθε browser. Για να ξεπεραστεί αυτή η ασυμβατότητα το πρώτο […]

[…] Podeis obtener más información sobre la propiedad border-radius, y como la interpretan los navegadores que la soportan en este artículo: border-radius. Apple vs Mozilla. […]

' src=

How I can set eight different values?

[…] in the same way that you specify multiple border thicknesses, margins or paddings. As describe by Peter Gasson on CSS3.info, in the Mozilla specification they allow only regularly rounded corners and thus you can specify a […]

' src=

It would also seem that Mozilla isn’t following the Border radius naming guidelines.

I cannot get

-moz-border-radius-bottom-left: 10px; -moz-border-radius-bottom-right: 10px;

to work, but I can get this

-moz-border-radius-bottomleft: 10px; -moz-border-radius-bottomright: 10px;

[…] topic has been described in detail on the css3.info website. It boils down to the fact that although the Firefox shorthand syntax of border-radius looks […]

' src=

applying background-clip (border) to border-radius elements will make it more smooth.

[…] CSS3.info – “All you ever needed to know about CSS3″ […]

[…] as it could, sacrifycing clarity but allowing for more flexibility. To cut a long story short, Webkit supports irregular curves instead of just circle quarters on each corner, so if you try to add 2 values, the result will be […]

[…] have developed proprietary extensions to CSS that should stand in for border-radius until certain ambiguities in the spec can be resolved, and the property is implented according to the standard. So if you […]

' src=

i want to know that how i give the rounded curve in IE 6,7,8 if any body have the code so plz help me or mail me :

[email protected]

[…] que nunca me rendeu proventos significativos. Alm disso, essa verso usa os recursos sombra e borda do css 3, algum dia presente em todos os […]

[…] It’s as easy as that! You could make things a bit simpler with some shorthand CSS, but it seems that browsers haven’t agreed on that matter yet. […]

' src=

We’ve recently done a few sites utilising border-radius as a key feature of the design, among other things such as RGBA background values, text-shadows, etc. �Images were used for some of the “major” corners so that IE users would see them as well, while we decided that they could deal without rounding on other elements. http://www.cssmelbourne.com/ – Melbourne University Commerce Students’ Society http://www.emrapee.com/ – Emergency Medicine Educators’ Podcast Feedback welcome!

' src=

Ya I’ve been doing this for awhile, however it doesn’t validate properly, even as CSS3…yet. For that reason I try to leave it out of my designs because employers enjoy things that validate.

also its border-radius-bottomleft with no hypen between sides

[…] The property can actually take two arguments, the horizontal radius and vertical-radius. Thankfully the design didn’t call for anything like that, because apparently the implementations are different. […]

' src=

about border-radius: 5px 10px;

Two years later, the dust seems to be clearing, and although Safari and Firefox don’t agree now, developmental builds of WebKit follow the same shorthand rules as Mozilla. You didn’t mention the / character in the shorthand, but now it is becoming relevant.

I’ve read the CSS3 spec a bazillion (OK, maybe ten) times, and while it’s not written well, the spec says (I’m pretty sure) that in the absence of a slash all corners are circular. So to get four matching elliptical corners you would use the shorthand

border-radius:5px /10px;

The shorthand allows you to specify from one to four horizontal radii, then one to four vertical radii. The two sets of values are applied with rules similar to margin , starting at the top left and going clockwise.

I made a little table that compares the spec to current browsers at my blog , if that will help anyone. I mark the parts I’m not sure about. When looking at the table, note that WebKit’s development builds follow Mozilla exactly (except they do the corner designations like the CSS3 spec.)

' src=

The earlier mentioned -khtml-border-radius [b]does[/b] work in konqueror and I recommend it’s use in addition to [b]-moz[/b] and [b]-webkit[/b]. (simply copy over the webkit lines in your css and replace the [b]-webkit prefix[/b] with [b]-khtml[/b].

[i]However![/i] last time I tried, the windows version of Konqueror did not round the border, on linux it does work.

' src=

 I know I’m going to get crucified for this one (Lord only knows), but I would almost be willing to wager that Microsoft will be the first 100% CSS-3-compatible client for the web. Why do I say that? Well, Microsoft has proven their affinity for going above and beyond in technologies (when they get the proper inspiration to do so). Now that they’ve professed to instill a level of standards compliance, I’m sure they’re going to go to every extent and make every effort to do so. Why? They don’t want to lose their clientel to better, FREE software. They want (need) to keep their monopoly on operating systems; they won’t risk losing users to *nix systems because they come fully equipped with standards-compliant browsers. General Web surfers need not to download a special browser so they can enjoy their sites; they’d rather it just come with the OS. *nix systems have that; Windows does not. So, I don’t think that Microsoft is going to allow that to come to pass.

What a glorious day it would be, indeed, if Microsoft once again reclaimed IE’s place as the de-facto Web browser. That will make it easier for us Web guys, anyway.

[…] The WebKit code is slightly different. For some reason i couldn’t get the webkitBorderRadius to work without doing each corner individually. For more info on the differences read this […]

[…] The WebKit pre is slightly different. For some reason i couldn’t get the webkitBorderRadius to work without doing each corner individually. For more info on the differences read this […]

' src=

I can’t get “-webkit-border-radius” working with 2 different corner sizes with Safari 4… it works fine with one value anyway…

Chrome is working well with “border-radius”

' src=

Konqueror does support -khtml- in the non standard webkit way -khtml-border-top-left-radius: 10px; opera joined on now with border-radius with their own way…Border-topleft-radius: 10px;

@PaulDE you have to have a different command for each corner, for webkit its -webkit-border-top-left-radius: 10px; -webkit-border-top-right-radius: 5px;

' src=

 This is a messy situation. The W3C have declared border-radius as the way to do this and only Opera (so far as I know) supports this. Why are FF, Saf, et al not ditching their proprietory methods and going with the standard here? So far, I’m using *3* seperate methods to apply round corners? This is not progress! Well done Opera though for applying sense to CSS3 in a way none of the other browsers seem to be willing to do.

Apologies to Google Chrome, which appears to render webkit and W3C methods! Hats off :)

' src=

 Here’s the css to get your corners working with FF, Chrome and Safari.

-moz-border-radius-topleft: 7px; -moz-border-radius-topright: 7px; -webkit-border-top-left-radius: 7px; -webkit-border-top-right-radius: 7px;

I added this to get my blog roll to look cleaner and works most browsers… have yet to try IE? visit the site to see the working example: http://www.frylowcaribbean.com

OUR SPONSORS

  • Book Reviews 4
  • Browsers 84
  • Competitions 2
  • CSS3 Previews 55
  • CSS3 Resources 9
  • Declarations 21
  • Interviews 13
  • Proposals 7
  • Scripting 4
  • Selectors 8
  • Site Updates 10
  • Summer Contest 6
  • Tutorials 16
  • Frederick Townes
  • Nicholas Shanks
  • Niels Leenheer
  • Peter Gasston
  • W3’s CSS Blog
  • WHMCS Themes from Impressive Themes
  • About CSS3.info
  • Entries RSS
  • Comments RSS
  • WordPress.org

© 2009-2012 WEBFLUX. All Rights Reserved.

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home › Forums › CSS › Border Radius for Outline?

' src=

  • Author Posts

' src=

I’m creating a double border using the border and outline property. I’ve applied border radius to the border. Unfortunately, I have no idea how to apply a radius on the outline.

[My live example can be viewed here.]( http://themeforward.com/demo2/?p=1948#comments “”)

[My full comment CSS can be viewed here.]( http://snippi.com/s/5tugbhk “”)

#comments .comment-body { min-height:150px; margin-left:65px; background:#EEE; padding:15px; border:10px solid #FFF; outline:1px solid #DDD; margin-bottom:10px; -webkit-border-radius: 50px!important; -moz-border-radius: 50px!important; border-radius: 50px!important }

' src=

how about using a box-shadow instead?

box-shadow: 0 0 3px #ddd;

' src=

Use box-shadow.

@wolfcry911 beat me to it.

alternatively, you could use a 1px border and use background-clip: content-box. This would require adjusting the padding on the container and margin on children

box-shadow should have the border radius by default. tested in FF and works

what browser are you using? Works for me in FF and Safari on Mac

lose the prefixed border-radius and !important – they’re not needed any longer.

and the border-radius needs to be larger than the border width or the interior (background) will be square.

' src=

If there is no other way to radius an outline then you can use the box shadow. Box shadow follows the shape of the element. You can use it like this:

box-shadow: 0 0 3px 0 #ddd;

  • The forum ‘CSS’ is closed to new topics and replies.

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using outline for focus rings breaks border-radius in Safari (15.4 latest stable; 15.4 Technology Preview Release 146) #767

@claviska

CetinSert commented May 28, 2022 • edited Loading

@CetinSert

claviska commented May 31, 2022

  • 👍 1 reaction
  • ❤️ 1 reaction
  • 🚀 1 reaction

Sorry, something went wrong.

@tobias-edwards

tobias-edwards commented May 31, 2022

  • 👎 1 reaction

@Pickra

No branches or pull requests

@CetinSert

  • | New Account
  • | Log In Remember [x]
  • | Forgot Password Login: [x]
  • Format For Printing
  •  -  XML
  •  -  Clone This Bug
  •  -  Top of page

CSS outline properties

The CSS outline properties draw a border around an element that does not affect layout, making it ideal for highlighting. This covers the `outline` shorthand, as well as `outline-width`, `outline-style`, `outline-color` and `outline-offset`.

  • Skip to main content
  • Skip to search
  • Skip to select language
  • Sign up for free

outline-offset

The outline-offset CSS property sets the amount of space between an outline and the edge or border of an element.

The width of the space between the element and its outline. A negative value places the outline inside the element. A value of 0 places the outline so that there is no space between it and the element.

Description

An outline is a line that is drawn around an element, outside the border edge. The space between an element and its outline is transparent. In other words, it is the same as the parent element's background.

Formal definition

Formal syntax, setting outline offset in pixels, specifications, browser compatibility.

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

  • outline-width
  • outline-style
  • outline-color

IMAGES

  1. Safari Animal Pattern Themed Portrait Page Borders

    safari border radius outline

  2. Safari Border Illustrations, Royalty-Free Vector Graphics & Clip Art

    safari border radius outline

  3. ios-safari-border-radius-and-scrollbar

    safari border radius outline

  4. Safari Bulletin Board Border

    safari border radius outline

  5. html

    safari border radius outline

  6. safari-border-radius

    safari border radius outline

VIDEO

  1. Mentality

  2. Fancy Border Radius Generator

  3. CSS|CLASS-3|border|padding|Margin|Outline|Border-radius|overflow|width and Max width| CSS in TELUGU

  4. CSS|CLASS-3|BOX-MODEL|BORDER|PADDING|MARGIN|OUTLINE|BORDER-RADIUS|BOX-SHADOW|BOX-SIZING|BORDER-BOX

  5. Elephant Parade_Unforgettable Safari Moments

  6. zimbabwe to botswana border crossing

COMMENTS

  1. Rounded cornes (border radius) Safari issue

    1. Instead of putting the border on the image itself, put it on the container. Make sure the border-radius is on both the image and the container. .img-container { border-radius 100%; border: solid 1px #000; overflow: hidden; } .img { border-radius: 100%; } answered May 13, 2014 at 7:38.

  2. outline

    Outline is a line outside of the element's border. Unlike other areas of the box, outlines don't take up space, so they don't affect the layout of the document in any way. There are a few properties that affect an outline's appearance. It is possible to change the style, color, and width using the outline property, the distance from the border ...

  3. Border-radius

    Note: Firefox only supported elliptical borders in 3.5+. Older WebKit browsers (e.g. Safari 4 and below) incorrectly treat 40px 10px the same as 40px / 10px.. Values. The border-radius property can accept any valid CSS length unit.That means everything from px, rem, em, ch, vh, vw, and a whole bunch more are fair play.. You may specify the value of border-radius in percentages.

  4. CSS3 Border-radius (rounded corners)

    Method of making the border corners round. Covers support for the shorthand border-radius as well as the long-hand properties (e.g. border-top-left-radius ) Chrome

  5. border-radius: Safari vs Mozilla

    border-radius: Safari vs Mozilla. With the release of Safari 3, there are now two browsers with (browser-specific) implementations of border-radius; unfortunately, the two implementations are different. The problem is that there is an unresolved ambiguity in the CSS 3 working draft. Each of them should accept two values, which define the radii ...

  6. Border Radius For Outline?

    lose the prefixed border-radius and !important - they're not needed any longer. and the border-radius needs to be larger than the border width or the interior (background) will be square. If there is no other way to radius an outline then you can use the box shadow. Box shadow follows the shape of the element.

  7. Outline and Border-radius are ignored on Safari #662

    This issue was closed. Description When you want to change outline and border-radius in css to the model-viewer object, it is being ignored in Safari while it works on Chrome. model-viewer { border-radius: 1rem; outline: none; } Browser Affected Chrome Edge Fi...

  8. css

    Safari is buggy with border-radius: -webkit-border-radius acts differently from -moz-border-radius. I recommend applying border-radius and overflow: hidden to a parent wrapper for the image. That parent will clip the image inside it.

  9. Using `outline` for focus rings breaks `border-radius` in Safari (15.4

    CetinSert changed the title Using outline for focus rings breaks border-radius in Safari Using outline for focus rings breaks border-radius in Safari (15.4 latest stable; 15.4 Technology Preview Release 146) May 30, 2022. claviska closed this as completed in b4e5544 May 31, 2022.

  10. How to make the border-radius property work on Safari with the ...

    How to make the border-radius property work on Safari with the appearance property - Online HTML editor can be used to write HTML and CSS code and see results. Source Code: (back to article) Submit Result: Report an issue ...

  11. CSS outline properties

    The CSS outline properties draw a border around an element that does not affect layout, making it ideal for highlighting. This covers the outline shorthand, as well as outline-width, outline-style, outline-color and outline-offset. 1 Also supports the value of invert for outline-color. (support of this value is optional for browsers)

  12. WebKit Features in Safari 16.4

    Outline + Border Radius. Until now, if a web developer styled an element that had an outline with a custom outline-style, and that element had curved corners, the outline would not follow the curve in Safari. Now in Safari 16.4, outline always follows the curve of border-radius. CSS Typed OM

  13. css

    Here is how it looks in Chrome, IE: in Chrome and IE How it looks in Safari latest version: in Safari. CSS code I have used for that elemt: outline: 1px solid #e0e0e0; background: transparent; width: 440px; height: 38px; padding-left: 16px; border: transparent; border-radius: 6px;

  14. border-radius

    Is a <length> or a <percentage> denoting a radius to use for the border in the bottom-left corner of the element's box. It is used only in the four-value syntax. <length>. Denotes the size of the circle radius, or the semi-major and semi-minor axes of the ellipse, using length values. Negative values are invalid.

  15. 231433

    In Safari, the outline rendered as a result of the `outline` CSS property does not respect the border radius set by the `border-radius` property. In both Chrome and Firefox, this combination works correctly.

  16. "outline-radius"

    The CSS outline properties draw a border around an element that does not affect layout, making it ideal for highlighting. This covers the outline shorthand, as well as outline-width, outline-style, outline-color and outline-offset. 1 Also supports the value of invert for outline-color. (support of this value is optional for browsers)

  17. css

    Border Radius to Google Map in Safari -webkit-mask-image: -webkit-radial-gradient(circle, white, black); -webkit-transform: translateZ(0); Use this snippet to both the map iframe and its parent div

  18. 深究 Safari 下 border-radius & overflow 不生效的问题

    而 Webkit 内核中,border-radius 对含有 Composite Layer 的元素的裁剪是存在 Bug 的,该问题可以追溯到 2011 年,很早就有人提出问题了。 Bug 68196: border-radius clipping of composited layers doesn't work. 发现该 Bug 在 2022 年 9 月 7 日已被标记为「RESOLVED FIXED」,在 2022 年 10 月 19 日发布的 Safari Technology Preview 156 中已修复。

  19. Why does border-radius not take effect on safari browser?

    I am making this card in react and using border-radius for the profile image. but the border-radius doesn't work on safari browsers. I have even used -webkit-border-radius:50% specifically for the safari browser. I cannot reproduce your problem on Safari (IOS). Can you make your code into a snippet we can run and check that it shows the problem ...

  20. outline-offset

    An outline is a line that is drawn around an element, outside the border edge. The space between an element and its outline is transparent. In other words, it is the same as the parent element's background.