Home
HTML
HTML Table Size
Example 2: HTML Table Size
Run ❯❯
<!DOCTYPE html> <html> <head> <title>Table Height Example</title> <style> table, td, th { border:2px solid black; border-collapse: collapse; } </style> <head> </head> <body> <h1>Table Height Example</h1> <table style="height:400px;"> <tr> <th>No</th> <th>Country</th> <th>Capital</th> </tr> <tr> <td>1</td> <td>India</td> <td>Delhi</td> </tr> <tr> <td>2</td> <td>Australia</td> <td>Canberra</td> </tr> <tr> <td>3</td> <td>United Kingdom</td> <td>London</td> </tr> <tr> <td>4</td> <td>United States</td> <td>Washington, D.C.</td> </tr> <tr> <td>5</td> <td>France</td> <td>Paris</td> </tr> </table> <p>Here height of the entire table is set to 400px.</p> <table style="height:100%;"> <tr> <th>No</th> <th>Country</th> <th>Capital</th> </tr> <tr> <td>1</td> <td>India</td> <td>Delhi</td> </tr> <tr> <td>2</td> <td>Australia</td> <td>Canberra</td> </tr> <tr> <td>3</td> <td>United Kingdom</td> <td>London</td> </tr> <tr> <td>4</td> <td>United States</td> <td>Washington, D.C.</td> </tr> <tr> <td>5</td> <td>France</td> <td>Paris</td> </tr> </table> <p>Here height of the table is set to 100%.</p> </body> </html>