CSS Liquid Round Corners
There are many techniques available to give your square boxes that nice rounded look but I thought I'd concentrate this article on the basic techniques used to create this box:
this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text this is some text
We won't be doing anything new or clever - just basic construction techniques that will produce a re-usable round box that you can then optimize and re-develop at your leisure. The first thing you need to know is that until css3 is fully supported then the only realistic way to do this at present is to use images.
When you're done with this article you will have a re-usable, cross-browser supported, semantically correct, liquid round box! Sound like fun? Let's begin!
Here are the images needed for this example:
![]() |
Left side image | ![]() |
Right side image |
| |
Top left image and top border combined | |
Bottom left corner and bottom border combined (including a bottom shadow) |
![]() |
Top right corner | ![]() |
Bottom right corner with shadow |
As you can see there are six images needed rather than eight (4 corners + 4 sides = eight images) because the top and bottom borders have been included on the top and bottom left corners as a combined image. This saves two images and 2 extra elements on which to hang them. However the downside is that the horizontal top border image must cater for all monitor widths and therefore the image is quite wide to cater for this fact. This isn't as bad as it may sound and the image file size is still relatively small and what we lose on file size we can gain by making the browser not work so hard in redrawing the page as would happen with 1px x 1px repeated images.
We could, of course, have applied the same logic to our side corners
and also included the side borders on two of the round corners as well.
This would have reduced our total down to 4 images and is something you
may want to experiment with yourself. Bear in mind though that the
height of a web page is almost unlimited and you may run out of border
if you use that method. Therefore for this demonstration we are using
repeating images for the sides so that the box can extend forever.
Put the following CSS in your stylesheet.
|
CSS:
#liquid-round { |
Put this HTML where you want the box to appear.
|
HTML:
<div id="liquid-round"> |
There are many other methods about for creating round boxes but in effect they all do the same thing and that is they find elements on to which they can hang their images. If you google "rounded corners" you will find many other examples to play with now that you understand the concept.
This article is a modified version of Search This.
Other Resources:
- http://www.cssjuice.com/25-rounded-corners-techniques-with-css/
- CSS Rounded Corners 'Roundup'
- http://www.spiffycorners.com/








