jQuery Table How to - Set table rows margin








Question

We would like to know how to set table rows margin.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.10.1.js'></script>
<script type='text/javascript'>
$(window).load(function(){<!--   w w w .j ava 2 s  .  c o m-->
    $("#table-id tr:eq(1) td").css('padding','25px').css('background','red');
});
</script>
</head>
<body>
  <table id="table-id" style="text-align: center;">
    <tr>
      <th>a</th>
    </tr>
    <tr>
      <td>b</td>
    </tr>
    <tr>
      <td>c</td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: