This tutorial shows you how to make round corners for divs. From scratch with and without jQuery UI library.
If you use other functions of jQuery UI library, then it is the way to go. If you don't then there is no point of using it just for making round corners. IE has problems with supporting rounded corners, so you have to consider that.
Using the jQuery UI library:
For this you need the library that you can get from jqueryui.com. Sample HTML code:Round corner classes in jQuery UI:Source code viewer
<!--This tutorial needs the jQuery UI library only, for css round corners--> <div class="ui-corner-all" style="border:1px solid black"> Here we have black round corners on every corner. You can also make a single corner round or only top corners. </div>Programming Language: HTML
- ui-corner-tl - top left corner
- ui-corner-tr - top right corner
- ui-corner-bl - bottom left corner
- ui-corner-br - bottom right croner
- ui-corner-top - top corners
- ui-corner-bottom - bottom corners
- ui-corner-right - right corners
- ui-corner-left - left corners
- ui-corner-all - all corners
Do It Manually:
I don't see any point of writing code from scratch if there are libraries allready made, but this is pritty heavy library and you don't want to use it just for rounded corners. Here is the CSS code of rounded corners:The radius is 5 pixels, but you can change it easily with find and replace.Source code viewer
.ui-corner-tl{-moz-border-radius-topleft:5px;-webkit-border-top-left-radius:5px;border-top-left-radius:5px} .ui-corner-tr{-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;border-top-right-radius:5px} .ui-corner-bl{-moz-border-radius-bottomleft:5px;-webkit-border-bottom-left-radius:5px;border-bottom-left-radius:5px} .ui-corner-br{-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;border-bottom-right-radius:5px} .ui-corner-top{-moz-border-radius-topleft:5px;-webkit-border-top-left-radius:5px;border-top-left-radius:5px;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;border-top-right-radius:5px} .ui-corner-bottom{-moz-border-radius-bottomleft:5px;-webkit-border-bottom-left-radius:5px;border-bottom-left-radius:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;border-bottom-right-radius:5px} .ui-corner-right{-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px;border-top-right-radius:5px;-moz-border-radius-bottomright:5px;-webkit-border-bottom-right-radius:5px;border-bottom-right-radius:5px} .ui-corner-left{-moz-border-radius-topleft:5px;-webkit-border-top-left-radius:5px;border-top-left-radius:5px;-moz-border-radius-bottomleft:5px;-webkit-border-bottom-left-radius:5px;border-bottom-left-radius:5px} .ui-corner-all{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}Programming Language: CSS