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.



It’s not so beautiful on Chrome 5 beta.
CSS3 makes our lives easier…
also worth looking into rounded corners!
Great tutorial, Thanks for sharing it.
I really need to go and give it a try.
Very nice CSS3 search form. I’ll have to apply that to the next search form I design. Also, I’m happy that it degrades gracefully. A lot of CS3-driven features degrade ungracefully, so this a relief.
@Pavel Kuts: Why not? Working using progressive enhancement is perfectly fine if you have explained it to your client and they are ok with it.
I can’t think how a shadow or a rounded corner will break the usability of a site.
It’s a beautiful style and I commend you for discovering it.
But, the fact that we still need a page of CSS to achieve something this trivial boggles my mind.
CSS3 or not, I don’t think we are making a lot of progress.
That’s cool !
Thanks alot
Wow, that IS beautiful! I never thought it would degrade so gracefully. Time to get on the css3 bandwagon!
CSS3 is fantastic at allowing us to very quickly create great-looking websites without resorting to Photoshop for dropshadows, gradients etc. It’s just a shame we still have to cater for those using Internet Explorer 6 too!
wow, amazing css tips/tricks, thanks for sharing!!
Cool. The circle trick is very impressive. Thanks for sharing this for us.
Like most everything else in web design and development, by the time CSS3 is truly crossbowser friendly, the focus will be on CSS4 and HTML6. Hmmm…maybe I should look at the bright side?
The more confusing it is to the inexperienced the better..right? It does creates a little job security for the designer/developers that take the time to learn the hacks.
Nice article , but in safari the go button is unclickable
Hi Andrew!
Just wanted to tell you that it doesn’t really work in Chrome 5.0.375. Here’s a screenshot of the problem. This is in Windows btw!
http://img440.imageshack.us/img440/6431/wdwbug.jpg
Nice!!
Looks nice. Can’t wait til CSS3 is widely accepted. Til then it feels like all the HTML5/CSS3 tutorials exploding everywhere are a total tease! Also, and don’t shoot me for this, but a lot of talk here discusses making sure stuff degrades nicely for IE6. IE6? I stopped supporting it. Enough is enough. Feed it and it’ll just linger. Starve it and it’ll die of!
In Chrome 4.1.249.1064 (45376) there is still box corners near the input.
Beautiful demo Nick!
Quick note on the CSS for the border radius… The border radius would only need to be 50px for an element with a height and width of 100px to make a perfect circle. Overshooting it like that will generally work and will “stop” at a perfect circle, but there were version of WebKit that borked it and just gave up and make square corners. Opera will also bork it if you overshoot it I think.
The circle trick reminds me of primary school. We had a very basic plotting program called ‘Logo’. Our teacher would challenge us to try to guess what the commands might be for various shapes, and a circle was the elusive shape we all wanted to create. One day I simply typed something like “fwd 1, right 1, repeat” and it drew a circle. My teacher wasn’t impressed; he wanted us to use the correct command, which turned out to be ‘arc’. Pah! Needless to say, I like your circle trick! Oh, and great search form, thanks
Thank you so much.. This was exactly what I was looking for my blog design: thedailyguitar.com. I’ll try setting up this search bar tonight.