Saturday, January 5, 2019

A table with left-aligned headings

A table with left-aligned headings:-   

<html>
<head>
<style>
table, th, td {
  border: 2px solid black;
  border-collapse: collapse;
}
th, td {
  padding: 5px;
}
th {
  text-align: left;
}
</style>
</head>
<body>

<h2>Left-align Headings</h2>
<p>To left-align the table headings, use the CSS text-align property.</p>
<table style="width:100%">
  <tr>
    <th>Firstname</th>
    <th>Lastname</th>
    <th>Age</th>
  </tr>
  <tr>
    <td>Akash</td>
    <td>Jaiswal</td>
    <td>20</td>
  </tr>
  <tr>
   <td>Ansh</td>
    <td>Rana</td>
    <td>24</td>
  </tr>
  <tr>
    <td>Jordan</td>
    <td>Singh</td>
    <td>28</td>
  </tr>
</table>

</body>
</html>

OUTPUT:-


  • To left-align the table headings, use the CSS text-align property.





No comments:

Post a Comment

Internal Javascripts

Internal Javascripts :    The script code can be written directly into the HTML document. script code is placed in header of the docume...