posted on:March 14, 2008
3 Simple Steps in Coding a Rounded Corners Layout
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!)
Enjoyed the article?
Then don't miss our next one! Subscribe to our RSS feed or share it with your friends.
Share on FacebookTweet thisDeliciousStumbleUpon RedditSubscribe
Comments (45 Comments)
Sorry, the comment form is closed at this time.
kevin
March 14, 2008
Niall Doherty
March 14, 2008
panDyskoteka
March 14, 2008
cssglobe
March 14, 2008
S.
March 14, 2008
Fubiz?
March 14, 2008
Optimas
March 14, 2008
giannhse
March 15, 2008
Alex -Tucson Web Design
March 17, 2008
Dallas Web Designer
March 17, 2008
Armen
March 18, 2008
John Faulds
March 19, 2008
Sunlust
March 19, 2008
Lee
March 21, 2008
Josh Miller
March 23, 2008
cssglobe
March 23, 2008
jive
March 24, 2008
Frank Rosendahl
March 27, 2008
Frank Rosendahl
March 28, 2008
Jad Graphics
April 2, 2008
ididthis
April 3, 2008
cssglobe
April 3, 2008
Quoka
April 4, 2008
James Abney-Hastings
April 5, 2008
Beth
April 8, 2008
krishnamoorthy manickam
May 8, 2008
Roman
May 20, 2008
Rsk
May 27, 2008
Matt Mikulla
June 4, 2008
Violetta Grawson
June 14, 2008
Ed Thomson
June 14, 2008
sophy
June 16, 2008
Kevin
June 16, 2008
Richard Vanbergen
July 7, 2008
Richard Vanbergen
July 7, 2008
Sean OBeara
July 17, 2008
Thomas
December 10, 2008
sergio
March 9, 2009
Diego
March 29, 2009
Tomy
April 5, 2009
W
April 17, 2009
zh
April 22, 2009
Ray Cassidy
May 1, 2009
Ahmed Elgendi
May 23, 2009
talha
June 12, 2009