-1

How to set a border-radius for a table. Read a lot of information about this, but nothing concrete.

<table id="table-prices"> 
    <tr>
      <td></td>
      <td colspan="2" class="table-main">Длина</td>
    </tr>
    <tr>
      <td>Ширина</td>
      <td>190 см</td>
      <td>200 см</td>
    </tr>
    <tr>
      <td>80 см</td>
      <td>5496</td>
      <td>5496</td>
    </tr>
    <tr>
      <td>140 см</td>
      <td>5496</td>
      <td>5496</td>
    </tr>
    <tr>
      <td colspan="3">Цены указаны в грн.</td>
    </tr>
  </table>

table {
 border: 1px solid #f00;
 border-radius: 10px;
 border-collapse: separate; 
 border-spacing: 0;
}
td {
 border: 1px solid #f00;
}

Almost done. But after border of table the angles are displaying. When I seting the owerflow-hiding - the grid inside table is lost

Barns
  • 3
  • 4

2 Answers2

3

If you are using border-collapse: collapse; than border-radius won't work, for example

table {
    border: 1px solid #f00;
    border-radius: 10px;
}

Demo
(The other table is using border-collapse: collapse; and hence border-radius fails)


It may happen that most of the users use CSS Reset Stylesheet, and it uses the snippet below..

table {
    border-collapse: collapse;
    border-spacing: 0;
}

So it fails, inorder to override that for a particular table you need to use

table.class_name {
    border-collapse: separate; /* Overriding collapsed border */
    border-spacing: 0;
}

Where GCyrillus already pointed you about the spacing, but he missed out the separate value for the border-collapse property.

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
0

to collapse table borders and still have access to border-radius, you should set border-spacing:0; instead of border-collapse:collapse;

G-Cyrillus
  • 101,410
  • 14
  • 105
  • 129