Easiest rounded corners ever
After an incredible amount of time spent looking for a way of easily rounding my corners, I've come across the one I find the easiest possible:
jquery + rounded corners plug-in
So now I'll explain how to install, use, improve...
Installation:
First of all, download and place the needed files:
- Download jquery directly (I renamed the file to jquery.js to simplify it)
- Download rounded corners plug-in directly (I renamed the file to rounded.js to simplify it)
Now place them in your desired folder, for this tutorial I'll be using "js/"
Usage:
In a html document, you would paste the following code in the head:
<script src="js/jquery.js" language="javascript" type="text/javascript"></script> <script src="js/rounded.js" language="javascript" type="text/javascript"></script> <script language="javascript" type="text/javascript"> <!-- $(document).ready(function() { $(\\'div.round\\').corner(); // Note: Due to wordpress formatting a backslash \ is introduced here. // You must delete it for the script to work }); --> </script>
And anywhere in your website's body, whenever you place a div with a class="round", its corners will be rounded.
To create special corners, or achieve special effects, visit my demo page, full of special tricks.
Special cases:
The round command fills the "rounded" area with the body background color, so if you place this inside somewhere with a different background-color you must specify what color you want the corner to have.
Here you have an example:
$('div.round').corner("cc:#F1F1F1");
If you want a bigger radius for your corners, just write the pixel radius in the parameters of corner():
$('div.round').corner("10px");
Example and demo page:
I've set up an example and demo page, with all possible ways to do this, just go and see.
If you find any problems or suggestions feel free to comment!
This entry was posted by alex on March 17, 2008 at 9:18 pm, and is filed under Javascript, Programming, Web-related. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site.
No example?
Yeah, I sort of miss some examples too; at least they can be found on the malsup.com link he has.
OK guys, attending to all that, I’ve created a custom demo page, similar to malsup.com’s, but in this server and with this styling and all.
If you still have any doubts about usage, comment here!