My Experiences – Manoj Goure

Research, Explore and Share

Rounded Curved Table without Image

html table curve without imageGetting curve for table corner in HTML is quite tedious task. There is no HTML tag for making curved corner for table. The only solution is to get image as a curve. That’s the reason I always avoid tables in my layouts. I don’t like to increase unnecessary HTTPs requests on my webpages.

Once I got myself into a situation where I cannot do away with table. I had to use the tables and with curved border only. Getting this done with Divs and CSS is quite possible but tables are little headache to play with in such condition.

With little tweaking in the code I achieved easily without using images. (This won’t work in IE. IE9 may support it.)

Examples of tables with curved border:

1. Table Without Cell Border

Name ID
Steve 0123
Peter 0124

The code for above table is

<table width=”200″ style=”background:#CCC;border:1px #333 solid;text-align:center;” class=”curve_b”>
<tr>
<td>Name</td><td>ID</td>
</tr>
<tr>
<td>Steve</td><td>Peter</td>
</tr>
<tr>
<td>0123</td><td>0124</td>
</tr>
</table>

The curve effect is being generated by class “curve_b” included in table (red color).  And CSS style code for the class is

.curve_b {
    border-radius:10px;
    -webkit-border-radius:10px;
}

2. Table With Cell Border

There can be two possibilities for the table with cell border, it can be with cellspacing or without cellspacing. We will see both examples.

a) Table with cellspacing

Name ID
Steve Peter
0123 0124

b) Table without cellspacing

Name ID
Steve Peter
0123 0124

Getting curve for tables having cell border need little extra coding. We need to define separate classes to each cell which has to be curved. See sample code below

a) Table with Cellspacing

<table width=”200″ style=”background:#CCC;border:1px #333 solid;text-align:center;”>
<tr>
<td class=”curve_tl”>Name</td>
<td class=”curve_tr”>ID</td>
</tr>
<tr>
<td style=”border:1px #333 solid;”>Steve</td>
<td style=”border:1px #333 solid;”>Peter</td>
</tr>
<tr>
<td class=”curve_bl”>0123</td>
<td class=”curve_br”>0124</td>
</tr>
</table>

b) Table without  Cellspacing

<table width=”200″ style=”background:#CCC;border:1px #333 solid;text-align:center;” cellspacing=”0″>
<tr>
<td class=”curve_tl”>Name</td>
<td class=”curve_tr”>ID</td>
</tr>
<tr>
<td style=”border:1px #333 solid;”>Steve</td>
<td style=”border:1px #333 solid;”>Peter</td>
</tr>
<tr>
<td class=”curve_bl”>0123</td>
<td class=”curve_br”>0124</td>
</tr>
</table>

CSS properties creating curve borders for table cells are

.curve_tl {
    border:1px #333 solid;
    border-top-left-radius:10px;    
    -webkit-border-top-left-radius:10px;
}

.curve_tr {
    border:1px #333 solid;    
    border-top-right-radius:10px;    
    -webkit-border-top-right-radius:10px;
}

.curve_bl {
    border:1px #333 solid;    
    border-bottom-left-radius:10px;        
    -webkit-border-bottom-left-radius:10px;
}

.curve_br {
    border:1px #333 solid;    
    border-bottom-right-radius:10px;    
    -webkit-border-bottom-right-radius:10px;
}

Note:

  • Firefox, Safari and Opera browsers support “border-radiaus” property, but not Chrome and IE.
  • Chrome support “webkit”.
  • IE does not support border curve properties.

Subscribe to email feed

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Rounded Curved Table

Getting curve for table corner in HTML is quite tedious ...

Step by step guide t

With latest technology and development in the electronic world, it ...

How to deal with bad

Online reputation is very essential for online business. If spoilt ...

3 Easy Tips to Speed

Page speed one of the hot topic these day in ...

What Causes Google P

Follow up of this post: Middle of Google Ban and ...

Twitter updates

No public Twitter messages.