Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1729 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Coding a rectangular box with rounded corners (with CSS)

Thread title: Coding a rectangular box with rounded corners (with CSS)
Closed Thread    
    Thread tools Search this thread Display Modes  
04-22-2006, 03:27 PM
#1
Yang is offline Yang
Yang's Avatar
Status: Member
Join date: Jun 2005
Location:
Expertise:
Software:
 
Posts: 460
iTrader: 0 / 0%
 

Yang is on a distinguished road

Send a message via Yahoo to Yang

  Old  Coding a rectangular box with rounded corners (with CSS)

How do I code this in CSS:



--------

I usually tackle this by slicing it into three parts: the top (1), the liquid middle (2), and the bottom (3), as shown on the image below:



--------

However, I found that the rectangular boxes (with rounded corners) on this website load such a way that each rounded corner loads at different times. This should mean that a different image is used for each rounded corner, and is a totally different method of slicing and coding.

My questions are:
1. How do you code using the second method described above?
2. Which method is better?

Thanks!

04-22-2006, 03:42 PM
#2
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

The method you described above is using tables, so it's not any better at all that the first method you described. However, if you are looking for a pure CSS method then this method is one of the best to use.

I would still use the method you described yourself though, unless you wanted the box to expand horizontally.

04-22-2006, 03:51 PM
#3
Hero is offline Hero
Hero's Avatar
Status: Very much the flyest.
Join date: Mar 2006
Location: Belgium
Expertise:
Software:
 
Posts: 1,171
iTrader: 1 / 100%
 

Hero is on a distinguished road

  Old

Just wanted to sugest that :P

04-22-2006, 03:54 PM
#4
Jonny is offline Jonny
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
 
Posts: 335
iTrader: 0 / 0%
 

Jonny is on a distinguished road

  Old

You could just use border-radius instead.

You will just have to wait a few years for it to be supported properly in browsers. (plus 10-15 for it to get supported in IE of course )

04-22-2006, 04:02 PM
#5
Yang is offline Yang
Yang's Avatar
Status: Member
Join date: Jun 2005
Location:
Expertise:
Software:
 
Posts: 460
iTrader: 0 / 0%
 

Yang is on a distinguished road

Send a message via Yahoo to Yang

  Old

Ahh it's such a tedious process looking through the source codes to understand something. Thanks though, Joe. Great source.

04-22-2006, 08:19 PM
#6
Mat is offline Mat
Mat's Avatar
Status: Junior Member
Join date: Feb 2006
Location:
Expertise:
Software:
 
Posts: 44
iTrader: 0 / 0%
 

Mat is on a distinguished road

  Old

An easy way is to use SpiffyCorners. It auto-generates the CSS code for rounded corners with whatever colors you want. Check it out at www.spiffycorners.com

04-22-2006, 08:26 PM
#7
seen.to is offline seen.to
seen.to's Avatar
Status: unusual suspect ™
Join date: Feb 2005
Location: Lancaster, PA from London UK
Expertise:
Software:
 
Posts: 1,814
iTrader: 0 / 0%
 

seen.to is on a distinguished road

  Old

SpiffyCorners generates way to much code for such a simple thing IMO.

I used a variation on the sliding doors technique for this work-in-progress.

Feel free to take a look at the html/css - but also be sure to make your own versions of the images :P

04-23-2006, 12:05 AM
#8
jono1 is offline jono1
jono1's Avatar
Status: Non-conformist
Join date: Jul 2005
Location: Canberra, Australia.
Expertise:
Software:
 
Posts: 1,172
iTrader: 0 / 0%
 

jono1 is on a distinguished road

  Old

Originally Posted by seen.to
SpiffyCorners generates way to much code for such a simple thing IMO.
Exactly what I was about to say. Both the Spiffy and Snazzy corners methods generate hugely bloated code meaning you end up with Divs there that are purely presentational which, in a way, goes against the whole idea of XHTML/CSS.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed