0

I have the following line for my table in HTML. How do I add a 10px radius to all the 4 corners?

<table id="Table_01" width="929" height="650" border="0" cellpadding="0" cellspacing="0">

As i am a newbie, I don't know what other information I must include. Please help me do this possibly by adding something like border-radius:10px to the above line. Thanks.

MajiD
  • 2,420
  • 1
  • 22
  • 32

2 Answers2

2

One of the ways where we use style tag if you cannot use external css :-

<style>
table{
  border:1px solid black;
  border-radius:10px;
}
</style>

<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Lak</td><td>14</td></tr>
<tr><td>Raj</td><td>17</td></tr>
<tr><td>Sheldon</td><td>15</td></tr>
<tr><td>Leonard</td><td>19</td></tr>
</table>
Lakshya Thakur
  • 8,030
  • 1
  • 12
  • 39
1

If you can't write in a CSS file, then you can write it inline, like so:

<table style="border-radius: 10px;">

But keep in mind that writing styles inline is not a very good practice.

Adam
  • 79
  • 9
  • Thank you for that, dear Adam. Why is writing styles inline not good? – Siamak Ensafi Apr 19 '21 at 08:55
  • Inline styles take higher precedence over styles written in a CSS file and the only way to overwrite them is by using the `!important` rule, which is also a bad practice, because it has the highest precedence. Also it clutters up the HTML and it is always good to have cleaner and simpler markup no matter the language. You can read more about CSS specificity here: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity and in the answers here: https://stackoverflow.com/questions/25105736/what-is-the-order-of-precedence-for-css – Adam Apr 19 '21 at 11:02
  • WOW, Adam, thanks for those tremendously complete words regarding the issue. I thank you very much. – Siamak Ensafi Apr 19 '21 at 11:13