Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to round the edges of a table. I use a code to achieve this.

This is the relevant CSS code.

CSS
#table-list {
    background-position:left;
    border: 1px solid #e3e3e3;
    background-color: #f2f2f2;
         border-radius:5px;
    -moz-border-radius:5px;
    -webkit-border-radius:5px;



}



Html code of its is mentioned below.

HTML
<table width="383" id="table-list">


but it didn't give rounded edges. Is any error in that code?? Please help me, if you know. Thank you.
Posted
Updated 5-Jun-12 5:49am
v2

1 solution

Here is the code sample I made:
HTML
<html>
    <head>
        <title>...</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css"><!--
            table {
                        -webkit-border-radius: 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px; border-radius: 20px 20px 20px 20px;
                        background-color:#ACE34D; padding:8px;
            }
            td {
                        border: thin solid; padding-left:2em; padding-right:2em; 
                        -webkit-border-radius: 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px; border-radius: 20px 20px 20px 20px;
            }
        --></style>
    </head>
<body>

<table>
<tr><td>Some data</td><td>More data</td><td>&nbsp;&hellip;&nbsp;</td></tr>
<tr><td>Some data</td><td>More data</td><td>&nbsp;&hellip;&nbsp;</td></tr>
</table>

</body>
</html>


It works, tested.

I did it with the help of this rounded corner generator: http://cssround.com/[^], added my own styles to make it look acceptable, without intersections of the borders and with proper padding.

See also:
http://www.css3.info/preview/rounded-border/[^],
http://jonraasch.com/blog/css-rounded-corners-in-all-browsers[^].

The trick is to meet the requirements of different layout engines at once.

—SA
 
Share this answer
 
v6
Comments
Tim Corey 5-Jun-12 13:22pm    
When you create something like this, testing it in jsFiddle is a great way to be sure it works. You can also then share the URL with the OP so that they can see it in action right away. Just a thought. +5 from me.
Sergey Alexandrovich Kryukov 5-Jun-12 13:26pm    
Thank you for the good advice, Tim.
As to sharing the URL -- to me, it's too much buzz for such a simple question. Anyone who is interested can use copy/paste from this page into some HTML file to see the effect it no time.
--SA
VJ Reddy 5-Jun-12 13:24pm    
Nice answer. 5!
Sergey Alexandrovich Kryukov 5-Jun-12 13:27pm    
Thank you, VJ.
--SA
Jeremy Shin Woo 5-Jun-12 13:37pm    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900