Advertisement
here2share

HTML table padding

Aug 16th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.77 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. table, td, th {
  6.     border: 1px solid #ddd;
  7.     text-align: left;
  8. }
  9.  
  10. table {
  11.     border-collapse: collapse;
  12.     width: 100%;
  13. }
  14.  
  15. th, td {
  16.     padding: 10px;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21.  
  22. <h2>The padding Property</h2>
  23. <p>This property adds space between the border and the content in a table.</p>
  24.  
  25. <table>
  26.   <tr>
  27.     <th>Firstname</th>
  28.     <th>Lastname</th>
  29.     <th>Savings</th>
  30.   </tr>
  31.   <tr>
  32.     <td>Peter</td>
  33.     <td>Griffin</td>
  34.     <td>$100</td>
  35.   </tr>
  36.   <tr>
  37.     <td>Lois</td>
  38.     <td>Griffin</td>
  39.     <td>$150</td>
  40.   </tr>
  41.   <tr>
  42.     <td>Joe</td>
  43.     <td>Swanson</td>
  44.     <td>$300</td>
  45.   </tr>
  46.   <tr>
  47.     <td>Cleveland</td>
  48.     <td>Brown</td>
  49.     <td>$250</td>
  50.   </tr>
  51. </table>
  52.  
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement