In this part of the pug tutorial series we will learn about how we can use html tables in pug.
HTML Tables are defined in pug with the help of table tag.
Table rows are defined with the help of tr tags, table headings are defined with the help of th
and table data defined with the help of td tags.An example is given below :
//Name of the file : tables.pug
table(style='width:100%', border='1')
tr
th Id
th Name
th Age
tr
td 001
td Adam
td 25
tr
td 002
td rahul
td 27
tr
td 003
td john
td 80
>pug tables.pug
rendered tables.html
tables.html file transformed from pug as shown below :
<!--Name of the file : ordered-lists.html-->
<table style="width:100%;" border="1">
<tr>
<th>Id</th>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>001</td>
<td>Adam</td>
<td>25</td>
</tr>
<tr>
<td>002</td>
<td>rahul</td>
<td>27</td>
</tr>
<tr>
<td>003</td>
<td>john</td>
<td>80</td>
</tr>
</table>
In this article we learned about
pug. Table tag in pug . tr tag in pug . th tag in pug . td tag in pug .