
So hopefully after reading – Understanding CSS – Padding, Positioning and CSS3 – you understand the basics of CSS and have been experimenting with other properties. It is important to remember that some properties will allow you to achieve effects that aren’t necessarily stated. In this post we will explore the property border-radius and how it can be used to create circles, semi-cricles and quarter-circles. It also has the potential to produce some terrific designs using just CSS – no images.
.round
{
border-radius: 5px; /* all corners have a radius of 5px */
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px 4px 3px 2px; /* corner values go clockwise so, first value is the top left, second, the top right, third, bottom right and fourth, bottom left */
}
Jean of Cats Who Code recently wrote an excellent article which included ways to achieve rounded corners in IE.
To render a circle using the border-radius property, simply set the border-radius value to half the width/height. Both width and height should be the same.

A beautifully rendered circle.
#circle
{
width: 200px;
height: 200px;
background-color: #a72525;
-webkit-border-radius: 100px;
}

An unfilled circle with border
#circle
{
width: 200px;
height: 200px;
background-color: #efefef; /* Can be set to transparent */
border: 3px #a72525 solid;
-webkit-border-radius: 100px;
}
Due to the way border-radius doesn’t curve the filled area as well, values for border thickness work well up to 4-5px depending on the size of the circle.

An unfilled circle with a dashed border
#circle
{
width: 200px;
height: 200px;
background-color: #efefef; /* Can be set to transparent */
border: 3px #a72525 dashed;
-webkit-border-radius: 100px 100px 100px 100px;
}
To create a semi circle, the width value most be half of the height value. The radius border for the top left and bottom left or top right and bottom right then have to have a value greater than that of the width. A semi-circle of the top and bottom section work much in the same way but with the height being half of the width and with the bottom right and bottom left or the top right and top left have values greater than the height

Look! A semi-circle
#semicircle
{
width: 100px;
height: 200px;
background-color: #a72525;
-webkit-border-radius: 200px 0 0 200px;
}
Very simple to achieve, just set a corner value to the same value as the width/height.

A quarter circle.
#quartercircle
{
width: 200px;
height: 200px;
background-color: #a72525;
-webkit-border-radius: 200px 0 0 0;
}

Same border techniques can be used.
By overlapping two circles you can create some interesting shapes. When overlapping make sure the shape on top has the same colour as the body background colour. You also need to use the position and z-index property to position one circle above the other. Z-index simply relates to layers. An element with a z-index of 1 will overlap an element with a z-index of 0 so long as they are positioned on top of each other.

Produce a wonderful arch effect
#wrapper
{
width: 1000px;
margin: auto;
position: relative;
}
#circle
{
position: absolute;
top: 100px;
left: 0;
z-index: 0;
width: 200px;
height: 200px;
background-color: #a72525;
-webkit-border-radius: 100px;
}
#circle1
{
position: absolute;
top: 105px;
left: 5px;
z-index: 1;
width: 200px;
height: 200px;
background-color: #efefef;
-webkit-border-radius: 100px;
}
These are just a couple effects that I managed to achieve. I am sure you could produce some exceptional art using these techniques. Why not give it a try? ![]()

A nice little crescent moon

A Venn Diagram

Discussion
That’s quite fancy. I especially like the moons. I will keep this in the back of my mind for the next time one of our designers dreams up something crazy with something circular.
.-= Gabe´s last blog ..Flip Flop Social Media Icons =-.
You can achieve much more than Crescent moons.
I didn’t want to spoil all the fun
Great and funny read Liam
Thnx for sharing.
.-= Shurandy Thode´s last blog ..Quick, fancy, dirty yet useful hover menu using jQuery hoverIntent =-.
No problem Shurandy, thanks for stopping by
You’re Welcome, Great blog! Stopping by frequently
.-= Shurandy Thode´s last blog ..Spotlights on: Bonaire Windsurf Kids “From nowhere to the Main Stage” =-.
this is software or css codings, good and i never know this about . thanks for sharing , its really hidden power
.-= sriganesh´s last blog ..Top commentators gets free Ad slot each month =-.
No problem Sri
nice one liam!
Thanks Will!
great long tut
helpful!
Thanks bud ^^
A very comprehensive tutorial on the border-radius property. This technique could even be utilised in website logos; all done without images. I’m definitely bookmarking this for future reference. Thanks Liam for the great read!
.-= Josh´s last blog ..Content-Driven Design – Let’s Throw out Tradition =-.
I totally agree, and have bookmarked as well. I really love the first crescent, as well as the Venn Diagram!
Funny you mentioned logos Josh, I was actually thinking at the time whether I could replicate the CD logo using this method. I reckon I could achieve a good 2D repesentation of the logo.
Very creative use of the border-radius property, I’m especially pleased to see that you combined 2 shapes, that was quite ingenious!
But it’s a shame I can’t think of any practical uses; that lovely red crescent just becomes a red square in ie8 and below..
Really nice!
You can see a few examples of border-radius we created in Brazil.
This is my example. But you can navigate to see other solutions.
http://www.maujor.com/blog/pg_apoio/desafio10/julio_bitencourt.html
Wow that’s awesome Julio, nice work
Thanks Liam! I forgot to say that it works only in Firefox 3.x. You know. Just testing…
.-= Julio Bitencourt´s last blog ..jQuery 1.4 alpha é lançada =-.
Julio…
You can easily make this effect work in Chrome, and Safari, by adding the following line to you CSS:
-webkit-border-radius: 10px;
The values are the same as the -moz-border-radius property.
.-= andy matthews´s last blog ..jQuery 1.4 support in AIR 2.0 and ColdFusion Builder 1.0 =-.
Thanks Andy! I tried the webkit-border-radius and it works very well !
A very well written article on border-radius. I imagine some really creative designs could be put together utilizing this technique. The colour venn diagram is pretty creative, along with the crescent moon. Great job Liam!
.-= Bluefaqs´s last blog ..70 Exceptional Examples Of Night Photography =-.
Thanks Shawn
I actually thought up this very idea a few months ago and implemented into a site, mine was slightly different use though.
My use of it was for pagination links that I wanted circular and expandable on font size change, so I used em measurements instead to keep the expanding circle circular!
Good to see other people using this effect to make circles
Wow Alastair you just blew my mind, excuse me while I try this
Wow great tutorial I didn’t think of using it like this, very cool
Indeed, thanks for stopping by Darren
Someone had to say this… IE.
Does not work with ie at all. Hopefully will be included in IE9, but till then… use jquery rounded corners.
Some of this effects can be done in IE with “dd_roundies”( http://www.dillerdesign.com/experiment/DD_roundies/ ).
ooo interesting, thanks for the link Kartlos
Great tut and *#@* IE
Well said
Wow, really cool. Thanks for that.
Wow! very cool effects
thanks for sharing.
Simple and Cool. Thanks
nice tut ! that is great
.-= Bankacı´s last blog ..Nasıl Emekli Olabilirim =-.
this is great man! didn’t realize what’s possible with border-radius. thanks!
Great share Liam,
overlapping effect is really awesome!
.-= Nikhil´s last blog ..Cross-Cultural Web Design: Thinking Global From the Start =-.
Thanks Nikhil, I loved you latest post btw 10 Alternative Uses for WordPress
Thanks friend!

.-= Nikhil´s last blog ..10 Alternative Uses for WordPress =-.
Nice article, here’s a rough experiment I put together a whole back using border radius: http://ryanroberts.co.uk/_dev/experiments/css-border-faces/
Ryan, thats so damn cool! Awesome work
Hey man, really cool. Thanks a lot!
You’ve done it again Liam.
You’ve let us glimpse into the world of what-ifs once more. It would be worth spending a half-a-day or so just testing out the variants.
I know that this round corner ability also works well with transparent backgrounds from my own mistakes(s)
, and happy are we that find even more as use becomes more prevalent.
again, thanks!
Very cool
thats pretty awsome and i understand the power of border radius etc..
but do all browsers support these? how about IE?
Hey Liam,
This was inspiring – so I decided to recreate my logo for my company using CSS3 techniques. Because of opacity, layering was required to ensure the colours stayed the way they were intended – source code and css is available by viewing source.
It uses EM so is completely scalable and uses Font Embedding for the correct font. I have tested in Firefox/Safari in Snow Leopard and FF on Windows
Thanks for the inspiration.
http://eightysix.co.za/border-radius-test.html – CSS example
http://eightysix.co.za/ – PNG Logo
Byron
.-= Byron Rode´s last blog ..Ripped… Or Not! =-.
Wow very nice Bryon. Love your logo and website.
The font looks perfect and works great with the mark.
Nice to see this technique produced a great version of your logo, will you be sticking to a CSS version rather than just an image?
Thanks Liam,
I have thought about it, but my biggest worry is how it will affect rankings, as it uses a lot of duplicated markup to get the effect correct. But I may code it at the bottom of the page and then push it up with absolute positioning, and just push the normal PNG logo for IE7+
.-= Byron Rode´s last blog ..Ripped… Or Not! =-.
“border-radius” property is totally useless if we want to be viewed and understood by everyone, even validated by W3C! However, for now you only can play with this in your own sandbox, entering town will bring you to ruin — this technology is just too young. It will take years to grow up.
Nice try.
“totally useless” – if this was the case no one would be using it. Even if the design does not look the same in all browsers, the design should still stay intact without any bugs.
Furthermore, the property does validate, you just have to change the CSS profile by viewing “more options” when validating.
Useless??? Why? Because it doesn’t work in IE? Ever hear of progressive enhancement? I’ve used this for circular pagination links…degrades to perfectly fine square links in IE.
border-radius is definitely a powerful tool, and with progressive enhancement (and the support of firefox, webkit/safari) can add some really nice effects to a site, but as Osvaldas pointed out this technique is still years from mainstream use (unfortunately).
Well it may be still years from “mainstream use”, but it will never be accepted if designers neglect it. I have played with it today to demonstrate how much more can be achieved with this property. Hopefully this post will lead to more designers implementing it into their designs and appreciating just how powerful it can be.
Very cool for a little css trick! I was impressed with the crescent moon which you did with the trick.!
.-= Lam Nguyen – AEXT.NET Mag´s last blog ..Four Common Steps Every New Blogger Would Face When Starting A Blog =-.
I made demo page.
http://aprilbriz.com/_test/border_radius.html
and I use DD_roundies library for IE.
.-= AprilBriz´s last blog ..CSS3 border-radius & DD_roundies (for IE) =-.
Wow it works! Only the quarter circle doesn’t work in IE. Thanks AprilBriz
Thanks for the great article Liam. Was very inspiring
.-= Dalesh Kowlesar´s last blog ..Traffic Spikes Are Determined By Your Overall Media Appeal =-.
Great post. I did think it was kind of cheating, though, to show off what CSS can do to make circle shapes by using images. Can’t wait to use the CSS3 border-radius properties on some of my websites!
simple and great. nice to read. thanks.
I decided to take what this tutorial showed and try and build on it! I made some of the flags of the world! Take a look if you’re interested!
.-= Codesquid´s last blog ..Flags of the world using only XHTML and CSS =-.
Very cool the trick overlapping them.
You could explain the diference between -moz and -webkit border radius when the developer wants to make just the top right corner border look fancy and etc..
Just for knowledge basis.
does Quarter Circle dont work on safari 4? coz i cant see the effect just like above.
anyone same like me or it just me cant see?
some cool ideas. i’ve created small circles with CSS3 before, but never thought of using it for stuff like crescent, semi-circles or venn diagrams!
Interesting aproach. I’m thinking out of the box whith border-radius and box-shadow and i have a have a lot of ideas.
- Bubbles and Spheres in order to show graphic data like excel diagrams. Business Intelligence in web browsers without flash. That’s a really cool goal. I don’t really like flash dependant suites. Not very customizable in order to success at client desires.
- Simple buttons to increase decrease, without images.
- Aproach to represent a 3D eye with css for example. With css transformations it could be done almost without images (i think it’s useless try to represent the eye without any image, but it could be done). Maybe it could be done like the coke can example I saw a few days ago. Mixed with css transformations.
I’ll give a try when I have time.
Uh, I forget to mention Pie charts.
Nice techniques!
Quite inspirational.
.-= ozzysong´s last blog ..Google Buzz, util y social =-.
Amazing tips. Thanks for shared
.-= SM´s last blog ..Новое доменное имя блога =-.
Exelent, is just that i need jejejej.
i dont speak english sorry. xD
.-= Kalvin Manson´s last blog ..Invitaciones para Google Wave gratis =-.
Big idea! i tried some stupid example here:
http://pacorabaco.it/de/dsadsa.html
it should be working at least in FF!
greetz from Italy
…and what about using many empty divs???
should it create any problems?
Thanks
Wow, this is really pretty cool. CSS3 will be pretty nice, which it would hurry up and get standardized.
One thing that will make your examples above easier to maintain is using percentages for the radii. That way when you resize your div you don’t have to adjust them.
The downside: no webkit support for percentage values, not even in the last nightly build I tried. I’ve spent way too much of my time compiling a table of the support for border-radius that some of you might find helpful. For simpler CSS you can use it as a guide, while for fancier stuff you can see how your favorite browser holds up.
http://muddledramblings.com/table-of-css3-border-radius-compliance
Hopefully that will be helpful to people.
Very cool effects. I definitely love the crescent moon one.
Great Job!!!
Thanks for this, it’s really interesting. The power of CSS!!
I just experimented with this and you can do some cool stuff. I credited you in my post
http://www.rob-allison.co.uk/fun-with-css-rounded-corners/
Hi.
Thanks for your guidance as to how to make circle boarders in blogs :]
I just have one question: is there a way where I could write in the boarders? as in, making the text go round the circumference of the circle(I’m referring to the ‘boarded circle’[second from top])?
Well, I hope that there is a way to do this as it seems that this website is the only one I can find that has the type of boarded circles that I want..
thanks a lot if you could.
An interesting thought. They only way I can think of achieving this would be to rotate each letter individually. Refer to this article: http://snook.ca/archives/html_and_css/css-text-rotation
I’m sure a javascript pro could develop a loop that rotates each letter corresponding to it’s position but in the meantime you’ll have to stick with individual letter rotation.
Or you could just use an image?
Depending what your constraints are, to get text that follows a vector path you can look at the canvas tag (HTML5), or SVG. Canvas s supported by all recent browsers except IE, and Google has a script you can link to that adds canvas to IE. Not sure which versions of IE it works on.
For graphics you want to generate in real time on the server, SVG is pretty dang cool. It’s XML-based and you can write scripts that directly manipulate the elements of the image as well. IE support requires a plugin from Adobe that is a little less transparent to the user than Google’s canvas script.
Both methods include gradients and time-based animation as well, so you can have your letters chase each other along a path, or have your bar charts “grow” from the baseline. I don’t know enough about either to declare one ‘better’ than the other; they were both developed to fix the same problems.
Great article and clever examples. Would be nice, though, if you linked to real demos instead of just showing images of each effect. That way we can test it in various browsers. I know that Chrome has problems drawing perfect circles created with border-radius (see circle at top of http://www.stunningcss3.com for example), and I wondered if your examples displayed this problem too.
Very helpful, thanks!
Nice post good work I visit your site daily
and work on it daily Hacking & Blogging
Leave a comment