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.