Search code examples
jquerymozillacss

CSS border-radius without vendor prefixes?


Is there any way to make radius border without -moz, cause this only works for on Mozilla browsers?

-moz-border-radius-topleft:3%;
-moz-border-radius-topright:3%;
-moz-border-radius-bottomright:3%;
-moz-border-radius-bottomleft:3%; 

Solution

  • You can go the jQuery way and get the excellent round corner plugin at

    http://jquery.malsup.com/corner/

    It's supported in all browsers including IE. It draws corners in IE using nested divs (not images). It also has native border-radius rounding in browsers that support it (Opera 10.5+, Firefox, Safari, and Chrome). So in those browsers the plugin simply sets a css property instead.

    Here's How to use it

    You need to include the jQuery and the Corner js script before </body>. Then write your jQuery like $('div, p').corner('10px'); and place before ''. So your html will look like the below code. Here i'm making round corners for all div and p tags. If you want to do it for specific id or class then you can do something like $('#myid').corner();

    <body>
        <div class="x"></div>
        <p class="y"></p>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript" src="http://github.com/malsup/corner/raw/master/jquery.corner.js?v2.11"></script>
        <script>$('div, p').corner();</script>
    </body>
    

    Check working example at http://jsfiddle.net/VLPpk/1