Lately I've been playing around with CSS3 and discovered some new CSS tricks. Did you know you can make a round circle with border-radius and create inner shadow effect with box-shadow inset? Check out this beautiful search form demo that I've created with CSS gradient, border-radius, and box-shadow. It displays perfect in CSS3 browsers and degrades gracefully in non-CSS3 browsers.
Round Circle Trick
You can create a round circle by specifying a very large value with the border-radius property. The following example uses 100px border-radius to make a round circle.
.circle {
width: 100px;
height: 100px;
-moz-border-radius: 100px;
-webkit-border-radius: 100px;
}
Inner Shadow Effect
Specifying inset values with the box-shadow property to create a inner shadow effect. As of now, this feature is only supported by Chrome 4+ and Firefox 3.5+.
.inset {
-moz-box-shadow: inset 0 3px 8px rgba(0,0,0,.4);
-webkit-box-shadow: inset 0 3px 8px rgba(0,0,0,.4);
box-shadow: inset 0 3px 8px rgba(0,0,0,.24);
}
Search Form Example
The following search form demo is created with CSS gradient, border-radius, and box-shadow with inset values (view the demo with Chrome 4+ or Firefox 3.5+). It degrades nicely in non-CSS3 browsers. View source code to learn the CSS code. If you are not familiar with CSS3, read my previous article The Basics of CSS3.



Very nice, I must say.
Oh great. I will try it.
I liked the search form example very much ..thanks…
Great tuts! Too bad there’s still some browsers doesn’t support CSS3 rounded corners
Oh great. I will try it.
Good, but if it doesnt work in IE, its not worth yet.
What the hell guys at Microsoft are doing with their Browsers..
Lazy.
even if microsoft update their browser, nothing will change, coz people and even government still stick with lousy ie6
Nice example, the search form looks really cool!
Nice tutorial, could use a little extra to make it cross browser.
Opera and IE9 preview edition support border-radius without the vendor prefix (as that’s now a stable part of the spec). It’s in the code for the demo but not in the sample above.
Opera supports inset box shadows.
nice but still not very much useful because of IE:(
Very nice… it works in Firefox, but works half in Google Chrome Linux 5.0.375.38 beta. It shows the round circle, but not the box for the searchtext
Curves not good in chrome/xp…
Nice, but you should also add border-radius on its own to the CSS to support future browsers such as IE9.
Does not work good in Chrome :-/
Done this style plenty of times before, never with pure CSS. Great, informative post.
I think the fact that it degrades so nicely means that you can use it with IE8-…sure you lose the rounded corners, but we ARE talking about degradation, here.
I will say that Chrome 4.1.x gets a little weird when the shadow is applied to the search box, but still – great job of getting us thinking about this idea!
It doesn’t work very well on Chrome
Nice one! You can also remove the ‘width’ CSS attribute of the button, so it adapts nicely to the text value.
Great work Nick. I really love the style and the fact that it degrades nicely means that it *IS* a practical solution people can use today.
Comments above are correct that on Chrome 4 (Windows) the rendering isn’t quite right. However, I’m sure this could be fixed with a bit of work.
Keep producing stuff like this, it’s really great!
All the best
Great stuff. Not quite correct in Chrome, but I’m sure with a few tweaks it can be sorted. Will definately take a look at this for a future project! Many Thanks.