# Simple table in template node aligning colums

**URL:** <https://discourse.nodered.org/t/simple-table-in-template-node-aligning-colums/53995>\
**Category:** Dashboard\
**Created:** [19 November 2021 13:25 UTC](https://discourse.nodered.org/t/simple-table-in-template-node-aligning-colums/53995 "2021-11-19T13:25:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [19 November 2021 13:25 UTC](https://discourse.nodered.org/t/simple-table-in-template-node-aligning-colums/53995/1 "2021-11-19T13:25:19Z")

</div>

I have a simple table and need to allign the columns. Can anybody tell me how?  
Table looks like this:  
 ![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b65d793fd35b3499d5b598d2573ea2a1bd4670a7.png)

I need 1st column left align, 2nd column right align and 3th column centered.

Template node looks like this:

```auto
<table id="table" border="1">
 <tr>
    <th colspan="3" >{{msg.title}}</th>
 <tr>
 <th>Omschrijving</th> 
 <th>Prijs</th>
 <th>Eenheid</th>
 </tr>
 <tbody>
 <tr ng-repeat="row in msg.payload">
 <td ng-repeat="item in row" >{{item}} </td>
 </tr>
 </tbody>
</table>

```

Hope somebody can tell me solution to this.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [19 November 2021 14:13 UTC](https://discourse.nodered.org/t/simple-table-in-template-node-aligning-colums/53995/2 "2021-11-19T14:13:41Z")

</div>

You could use css and give each column a id or class, here is a rough example

```auto
<style>
	#column0 {
		text-align:left;
	}
	#column1 {
		text-align:center;
		}
	#column2 {
		text-align:right;
	
	}
</style>

<table id="table" border="1">
 <tr>
    <th colspan="3" >{{msg.title}}</th>
 <tr>
 <th>Omschrijving</th> 
 <th>Prijs</th>
 <th>Eenheid</th>
 </tr>
 <tbody>
 <tr ng-repeat="row in msg.payload">
 <td ng-repeat="item in row" id="column{{$index}}">{{item}} </td>
 </tr>
 </tbody>
</table>

```

---

<div class="post-metadata">

**Author:** ![henkkas](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henkkas/32/39844_2.png) [@henkkas](https://discourse.nodered.org/u/henkkas)\
**Post date:** [19 November 2021 14:49 UTC](https://discourse.nodered.org/t/simple-table-in-template-node-aligning-colums/53995/3 "2021-11-19T14:49:35Z")

</div>

@E1cid , thanks very much again for solution.  
Quit simple even I can understand. This is good enough for me 🙂

Here is result:

![afbeelding](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f118852974a8ea248e5183fcc1a56114471fe3c0.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 December 2021 14:50 UTC](https://discourse.nodered.org/t/simple-table-in-template-node-aligning-colums/53995/4 "2021-12-03T14:50:19Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
