StylizedWeb

Subscribe to our updates:

A Design, WordPress and Tutorials Blog.

Dedicated to helping you learn the art and science of the web.

CSS 3 Rounded Corners

When New WordPress started using this i though you know Internet Explorer is definitely out now when i'm doing some css work that needs rounded corners I'm mostly using only this technique because buyers are ok with it although it's just for FireFox and Safari. And since most of people still don't know about this i figured it's good thing to share.

Of course i'm talking about Border-radius property for FireFox and Safari 3 (only). And here are some nice examples how to use it.

 
#box {
     background: #eee;
     border: 1px solid #ccc;
     padding: 15px;
     -moz-border-radius: 10px;
     -webkit-border-radius: 10px;
}
 

And now FireFox and Safari 3 users will have rounded corners.

Nice, huh ;)

And of course you don't have to make all corners rounded, it can be just top left etc, so the code goes like this (small not, for example you can't make rounded corners on images and stuff like that)

  • -moz-border-radius-topleft and -webkit-border-top-left-radius
  • -moz-border-radius-topright and -webkit-border-top-right-radius
  • -moz-border-radius-bottomleft and -webkit-border-bottom-left-radius
  • -moz-border-radius-bottomright and -webkit-border-bottom-right-radius

Update: I've just ran into border radius for opera (example -opera-border-radius: 10px;) but i haven't tested it yes, so i'm not sure it's working, anyway go to know.

Leave a comment on Stylized Web Have some feedback? Leave a comment

51 Comments So Far

  1. By Damane posted on August 19, 2008 at 1:04 pm

    Nice Stuff! Thanks man

  2. By James posted on August 19, 2008 at 1:05 pm

    cool ! keep it coming

  3. Nice work dude, thanks for the tip! Can IE just go away now, please?

  4. Tested it in Opera and it doesnt work. But thanks! It rocks in Firefox!

  5. This really is awesome!!

  6. Pingback: Leonaut.com

  7. Pingback: CSS3 ile Gelen Köşeleri Kolayca Yuvarlama Özelliği at gKAANs.oRg - teknoloji & internet blogu!

  8. By Tumbleweed posted on August 20, 2008 at 12:31 am

    Well, I’m not sure I’d call this ‘CSS 3′, but ‘third-generation’ browser rounded corners. Both of those are browser-specific, not in the CSS spec (though they’re being implemented alongside CSS 3 stuff). Still, neat trick, and it degrades very well on IE & Opera, so there’s no harm in using it. Right on. I love how it even supports borders.

  9. By Tumbleweed posted on August 20, 2008 at 12:48 am

    I just tried this with form elements in FF3, and it works beautifully! I’d suggest you give identical padding values for the input fields as your radius, so you don’t get any cursor or text overlapping the rounded edges. When you do a SELECT, it looks much better to only round the left side of the element, and leave the right side where the dropdown button is square. Looks *really* sharp, especially with hover/focus/active border/background color changes. Let’s hope IE8 implements this in a fully compatible way.

  10. Personally, I use the Nifty Corners solution, which creates rounded corners via JavaScript. Only works for people with JavaScript enabled, but you’ll find that’s a lot higher than people who use Firefox and Safari (though I’m a dedicated Firefox user myself).

    I have a half written WordPress plugin to do this. I use it myself, but it needs some polishing before it could be released – I hope to get back to it someday!

  11. By Dejan Cancarevic posted on August 20, 2008 at 9:59 am

    Tumbleweed,
    Have you seen wordpress admin buttons etc (new version) ;)

  12. Hey, that’s great!

    @tumbleweed, this is CSS3, isn’t it?

  13. By Tumbleweed posted on August 20, 2008 at 7:05 pm

    @gareth:
    It’s a CSS3 ability, but these are using browser-specific attributes, so if IE8 implements the actual CSS3 versions of these, -moz and -webkit things won’t work, so you’ll get to repeat these for each browser you want it to work in. As long as it works, though, that’s not such a high price to pay, just irritating.

    @dejan:
    Nope; I”ll have to check those out. Is this in 2.6, or are you taking about the 2.6.1 I see mentioned over in the side panel right now?

  14. By Dejan Cancarevic posted on August 20, 2008 at 7:18 pm

    Tumbleweed,
    They started using it from 2.5 ;)
    http://stylizedweb.com/2008/03/19/wordpress-25-interface/

  15. Seeing as you’re already invalidating your CSS by using proprietary commands when you do this, I always chuck in border-radius:10px; too — that way my great grandchildren will be able to appreciate the full glory of no sharp edges with their IE9s.

  16. By Tumbleweed posted on August 21, 2008 at 10:52 pm

    @Barney – that’s how I’m planning on using this, too. Totally cannot wait to use FF6 instead of IE9! :)

  17. Pingback: Linkswitch: Coders FTW - FreelanceSwitch - The Freelance Blog

  18. Pingback: thinkerpool.com: » Linkswitch: Coders FTW

  19. The opera solution does not work. There’s a dev article written by David Storey that explains how to use SVG to accomplish rounded corners in Opera, but it’s a hack at best. IE8 is also a no go. However, the good news is that webkit declarations also work with Chrome and knowing how Google is peeving Microsoft lately, this may put a little fire under the IE team’s tails.

  20. Chrome actually does a horrible job rendering this. Looks great in Firefox and Safari though.

  21. By Dejan Cancarevic posted on September 14, 2008 at 10:53 pm

    Knoxville,
    yes i know, also lists (unordered) look really bad in chrome, but all the rest i think is good!
    Also you might notice that it renders float right like safari so this is also one of the problems

  22. This is a good technique for Safari and Firefox users. I wrote an article covering how to stick with CSS3 corners for them but fall back to corner images in IE, since there doesn’t look like any chance that IE will support border-radius any time soon.

    you can see the article here

  23. By Dejan Cancarevic posted on September 16, 2008 at 10:39 pm

    That’s a good article Bill!
    If you have something else interesting feel free to share it here on stylized web ;)

  24. Thanks for this very cool post buddy. Keep sharing new ideas and we will keep passing by with you blog…

  25. Pingback: how to play scratchcard

  26. Pingback: Kaan Şengül » CSS3 ile Gelen Köşeleri Kolayca Yuvarlama Özelliği

  27. Pingback: blak jak training classes player dealer

  28. By Natasha posted on November 27, 2008 at 2:17 pm

    I found a nice css technique to create curved div using just 3 line css
    http://www.htmlremix.com/curved-corner-border-radius-cross-browser/
    It works in IE6+ , FF all and all webkit browsers like safari and Chrome.
    Its a fresh concept

  29. Nice Stuff! Thanks man

  30. The code above also works on Google Chrome and in Chromium

  31. Thanks for that. ;)

  32. thanks admin exciting blog
    information is the most beautiful treasures

  33. You can have a look at FlexiPanels CSS – a Dreamweaver extension that helps you create rounded corner CSS boxes without coding.

  34. vdv xvxcv

  35. If you replace the “opera” with just an “o” it work’s fine in the latest Opera Browser.

    -o-border-radius: 10px;

    Maybe also in earlier versions but I only got the latest.

  36. hi…its good toutrials but its not working in internet exploer 7
    please provide me its solution……..thanks

  37. Pingback: Soursday Srok Khmer » Blog Archive » Crée Coins arrondis Css3 avec Wordpress 3 et 2.x

  38. thanks for code CSS3

  39. By Pavel Vodička posted on October 21, 2010 at 9:04 am

    Just add standard
    border-radius: 10px;
    and in Opera 10 and other browsers (incl. IE9) it works

  40. Pingback: Rounded Corners | ✽ Cecilia Hartvig-Bollin ✽

  41. By Petar posted on February 11, 2011 at 4:16 pm

    Pavel’s right, you don’t need the -opera (don’t even think it works) any more, you can just run it as:

    border-radius: 5px;

    To add on, the individual sides would be (for Opera / IE9):

    border-top-right-radius: 5px;
    border-top-left-radius: 5px;
    border-bottom-right-radius:5px;
    border-bottom-left-radius:5px;

  42. %100 Doğal ve hiç bir yan etkisi olmayan Uzamax’ı keşfedin
    UZAMAX içeriğinde mineral ve vitaminler barındıran, doğal bitkielerden üretilmiş gıda desteğidir. İçeriğinde herhangi bir kimyasal ürün bulunmamakla birlikte tamamen doğal kurutulmuş bitkisel bir karışımdır. Sadece birkaç aylık kullanım kürü sonrasında bile uzamax’ın etkisini hissedeceksiniz.

    Uzamax kullanarak doğal yollarla bünyenize gerekli olan tüm besin, vitamin ve mineralleri vücudunuza almanızı sağlar.izlanda yosun hapı

  43. bayanlarla kameralı görüntülü sohbet

  44. oh my!! i love you so much!!

    It’s really great article. I would like to appreciate your work and would like to tell to my friends.

  45. worked for me :) .. thanks
    lol .. I feel so under water right now

  46. Great tutorial, We at http://www.fredricksw.com/devshack/ also post tutorials similar to this come visit us :)

  47. another CSS
    realy Im reading post so fast ;)

  48. By ying posted on August 29, 2011 at 10:25 am
  49. Just add standard
    border-radius: 10px;
    and in Opera 10 and other browsers (incl. IE9) it works

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>