This is the original article. The technique has been improved with better browser support and a lot of new features. The new article has been published on the 6th of April 2005. You can read it here. The final version is Niftycube.
Rounded Corners with CSS are a hot topic in web design: I think that there are hundreds of articles on them. This page is intended to present the solution I came up, that doesnt requires images, extra markup nor CSS. Lets start.
The basic idea of Nifty Corners is to get some coulored lines to get the rounded effect. This is the markup to get a rounded div:
The technique works even on floated, absolute positioned or percentage-width elements. It fails on element with fixed height, or with padding. Both of the problem could be easily solved with an extra wrapper around the content.
The support should be extended to all modern browsers: the technique has been tested with success in Internet Explorer 6, Opera 7.6, FireFox 1.0, Safari 1.1 Mac IE. It fails on IE 5.x PC.
In the example we saw how to get rounded corners without images, sparing about 6-8Kb of page weight. But we love webstandards and semantic markup and wed like to maintain the HTML clean and light.
The first three components just dont need changes, whatever you want to accomplish. They need just to be declared in the head section of any HTML page like this:
The function NiftyCheck performs a check for DOM support and excludes IE5.x PC for running the script. If the test has passed, the Rounded function is called. It accepts four parameters:
The real strenght of the function is that is capable of accepting a CSS selector to target the elements to round. The accepted parameters are:
About the colors: they should be specified in hex code with # symbol in three or six digits. The outer color could be also set to transparent.
The fourth parameter is optional and must be setted to "small" to get small rounded corners. Lets see an example:
I ve provided also two additional functions that you could find very useful: RoundedTop and RoundedBottom that receive the same parameters of the Rounded function and allow to get rounded corners just on the top or on the bottom of page elements, or all four corners but with upper ones that differ in color from the lower.
In this example, two divs were rounded. The js calls are:
In this example the heading has small rounded corners. The code:
In this example well see how to make 2-colour newsboxes. The code is:
In this example, I rounded a form and its labels with two js calls:
You could download the zip file containting the script, the html and the css of the example that were presented here.
James Webb Young wrote about 40 years ago in his little gem "A technique for producing Ideas":
So, I think the idea about Nifty Corners wouldnt have been possible without these readings in past or recent times:
I was born in northern Italy in 1975.
|orbitz||online recrd||amortization schedule||order checks||paulo lins|
|breeder||hotels in||powerball||process improvement||radio shack|
|business for||canon||huge cock||imdb||calendar for|
|chevelle||chris angel||search engines||kid rock||search engine|
|college||coaching daffaires||consumer wholesale||cowboy jobs||kyoto|
|different cultures||mechanical inspections||data protection||toshiba||maryland|
|member web||u tube||ubiquitin antibody||mfan millennium||translate|
|msn download||nada||multi camera||example letter||video game|