ADVERTISEMENT
ADVERTISEMENT

Space between two rows in a table using CSS

Learn, how to define space between two rows using CSS?
Submitted by Apurva Mathur, on May 21, 2022

Space between two rows can be simply done by giving appropriate padding and border-spacing.

padding property: Padding is the area between the element content and the element border or else we can say, Padding is the space around the element.

border-spacing property: This property basically sets the distance between the borders of neighboring table cells.

Example:

<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
         border: 2px solid cadetblue;
         padding: 10px;
         width: 50%;
         }
         table {
         border-spacing: 20px;
         }
      </style>
   </head>
   <body style="padding-top: 70px;">
      <center>
         <table style="width:70%">
            <tr>
               <th>States of India</th>
               <th>Capital</th>
            </tr>
            <tr>
               <td>Andhra Pradesh</td>
               <td>Hyderabad</td>
            </tr>
            <tr>
               <td>Arunachal Pradesh</td>
               <td>Itanagar</td>
            </tr>
            <tr>
               <td>Assam</td>
               <td>Dispur</td>
            </tr>
            <tr>
               <td>Bihar</td>
               <td>Patna</td>
            </tr>
         </table>
      </center>
   </body>
</html>

Output:

Example: Space between two rows

CSS Tutorial & Examples »


ADVERTISEMENT
ADVERTISEMENT


Comments and Discussions!



ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.