Jens Krämer

Well behaved rounded corners

 |  css, design, javascript

Throwing together Ben Nolan’s great Behaviour lib and Alessandro Fulciniti’s DomCorners:

var myrules = {}; // only add this rule if browser is supported: if (DomCheck()) { myrules['div.rounded'] = function(element) { DomCorners (element, 'transparent.gif', 5); } } Behaviour.register(myrules);

And with the help of Behaviour, every div with class rounded will - you guessed it - get rounded corners.

sample page

Of course there’s not much point in using this approach if you don’t do any other scripting in your page - the nice declarative style of Behaviour probably isn’t worth letting your visitors fetch the additional 8kB of Code just for adding rounded corners. You’d better use the original, very lightweight standalone DomCorners script.

Comments

You can use Markdown here.

For the sake of spam checking any data you submit, including your IP address, will be transferred to the US based Akismet web service (akismet.com). If that's not acceptable for you, you can also reach me by other means.