![]()
What we should aim in coding is simplicity and try to avoid any unnecessary markup. Various rounded corners techniques often include several additional elements that are purely presentational.
When talking about fixed width, rounded corners layout, there's no need for complications.
Let me show you my approach to coding just that, fixed width, rounded corners layout in 3 simple steps.
As a special treat, PSD and XHTML/CSS files included in this brief tutorial :)
Take a look at the demo | Download zip file

Markup
Markup is pretty basic, and as you can see, there are no additional divs for top or bottom corners.
<div id="container"> <div id="header"></div> <div id="content"></div> <div id="footer"></div> </div>
Step 1 - Header
In order to simplify things I often crop entire header as a single background image. The size of the image rarely exceeds
50kb and it also makes additional changes a lot easier to apply.
With this particular layout we'll add something extra to the header cropping. We'll not
only crop entire header, but the top corners of the content area as well. That area is not
meant to have any content, it's just for presentation. It really doesn't matter if we put it at
the bottom of the header background image.

Note: if you use repeating gradient image for body background, like I do in my example, keep the height of the repeating image same or less than header height. That will make your life easier because you will not have adjust the body background in the content area.
Step 2 - Content
Unlike other sections, content area is expandable in height. Of course, we'll use 1px high gif that repeats vertically. We all know that :)

Step 3 - Footer
Similar as with header, we are avoiding additional markup for bottom corners of the content area. So, we'll "close" the content area with footer background image. So footer's background is used for end of the content and beginning of the footer.

That's it, view live example or download files (PSD included, yeah!)
kevin 14 Mar, 2008
Niall Doherty 14 Mar, 2008
panDyskoteka 14 Mar, 2008
cssglobe 14 Mar, 2008
panDyskoteka, as more people start to read Css Globe I realize that they are not all experts and I wanted to share something simple.
S. 14 Mar, 2008
Thanks!
Fubiz? 14 Mar, 2008
Optimas 14 Mar, 2008
regards
giannhse 15 Mar, 2008
Alex -Tucson Web Design 17 Mar, 2008
Thanks!
Dallas Web Designer 17 Mar, 2008
Armen 18 Mar, 2008
Stumbled!
John Faulds 19 Mar, 2008
Sunlust 19 Mar, 2008
Thanks a lot for this post and for downloable version.
Sunlust
Lee 21 Mar, 2008
Josh Miller 23 Mar, 2008
cssglobe 23 Mar, 2008
As for the footer you can easily make it variable in height if you use additional elements. I often use a paragraph with copyright info for the "bottom" element.
jive 24 Mar, 2008
<h1 id="headerimage">Rounded Corner header</h1>
<p id="contentbackground">Rounded Corner Content</p>
<div id="rooterimage">Rounded Corner Footer</div>
Less markup and a bit more semantically correct.
Frank Rosendahl 27 Mar, 2008
<!--[if IE]>
<style type="text/css">
... your MS IE spesific css here... or even linking a css-file...
</style>
<![endif]-->
Read more: http://www.quirksmode.org/css/condcom.html
http://msdn2.microsoft.com/en-us/library/ms537512.aspx
Frank Rosendahl 28 Mar, 2008
Jad Graphics 2 Apr, 2008
ididthis 3 Apr, 2008
cssglobe 3 Apr, 2008
css IS easy :)
Quoka 4 Apr, 2008
In this age of "do it with Javascript" , many people seem to forget the simple options
James Abney-Hastings 5 Apr, 2008
Beth 8 Apr, 2008
it is indeed very easy to get lost up your own nether regions when bumping over from static, image/table based layouts to a more flexible css route. as i've found recently.
all these statements, whether you're new to this industry or not, make absolute sense.
good man. have a banana.
krishnamoorthy manickam 8 May, 2008
Roman 20 May, 2008
When developing kogelberg.at I was using this as a source
http://www.alistapart.com/articles/customcorners2/
4 singel images that define the background of your box, and, given enough height/width, the images scale with the size of your browser fontsize. I think it's far more advanced, although not so easy to maintain, if you want to exchange the background images.
To get an idea, tak a look at
kogelberg.at
But I really appreciate the design of your website - currently about to explore :-)
Regards, Roman
Rsk 27 May, 2008
Matt Mikulla 4 Jun, 2008
"3 Simple Steps in Coding a Rounded Corners Layout"
It really reinforces the truth that we can make things simple. Sure, you could slice up the layout into more images and allow for flexibility, but as you mentioned, you would need to edit all of those slices if your layout needed alteration. I would rather edit 3 than many more and then have to hassle with more html and css markup.
Violetta Grawson 14 Jun, 2008
Thanks!
Ed Thomson 14 Jun, 2008
sophy 16 Jun, 2008
Kevin 16 Jun, 2008
Richard Vanbergen 7 Jul, 2008
<div>
<img src="example.jpg" class="leftBorder"></div>
<div class="headerBG"><h1>heading</h1><p>Tagline</p>
<img src="example.jpg" class="rightBorder"></div>
</div>
For the header, a 1x250 image (repeat-x) will load a lot faster then a 800x250 images.
There is a reason we like to make things difficult for ourself. ^^
Richard Vanbergen 7 Jul, 2008
Sean OBeara 17 Jul, 2008
Thomas 10 Dec, 2008
If I would like to make an 800 px width site, how do I apply your technique to it?
I'm doing an project which has to be done on monday, and my only obstacle is making the rounded corners..
Please link to or make a small psd-segment-how-you-did tut.
Thanks alot / T
sergio 9 Mar, 2009
People asking for rounded corners already know to use photoshop. No need to say what we were expecting. Almost an insult.
Diego 29 Mar, 2009
It helps me a lot with a new project I'm working on.
Thanks!
Tomy 5 Apr, 2009
i have a question:
Can I use this template in my projekt ?
thanks for answering
W 17 Apr, 2009
I have a striped background with rounded corners so I need the transparency of the header and footer.
Great article.
Thanks.
zh 22 Apr, 2009
good luck!
Ray Cassidy 1 May, 2009
Cheers,
Ray
Ahmed Elgendi 23 May, 2009
regards
Ahmed
talha 12 Jun, 2009