how to place HTML table code in confluence page?
Asked by Kirti sabade:

I am having issue in displaying HTML table in confluence. Table works fine in browser but not in confluence. is there any specific plugin/macro which needs to enabled? please help me with this.


Answers:
author: DPKJ
body: You need to do this inside HTML macro, in newer version of confluence this macro needs to be enabled from Admin screen.

comments: author: Kirti sabade
body: Hi,

Thank you for your kind response.

I have code inside HTML macro. Version of confluence is 6.13.4. Table is displaying in browser but not in confluence. Please help me with the solution..


author: DPKJ
body: Have you sanitized markup for table?

Can you share small snippet of editor from confluence where you are adding table html code.


author: Kirti sabade
body: ![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/64158iF5B1203B096A3C6A/image-size/large?v=v2&px=999 "Capture.PNG")Okay, i have this HTML code for table which i directly written in HTML macro of confluence. In browser it's showing proper colored,bordered table but in confluence it's not showing any table,


author: DPKJ
body: [@Kirti sabade](/t5/user/viewprofilepage/user-id/3284206)

There are few points here,

* HTML macro is not meant for creating new html page inside existing HTML page of confluence.
* If want to style table differently, start with \<table\> tag, and use inline styling for its elements.
* If you still want to create full \<html\> then try wrapping it in \<iframe\>.

Like this for inline styling,

```
<table>

<tr><th style="color: #FF0000;">Head</th></tr>

<tr><tr style="color: #00FF00;">Row</tr></tr>

</table>
```

And like this for \<iframe\> wrapping

```
<iframe>

<!DOCTYPE html>

<html>

<head>

<style>

table th {

color: #FF0000;

}

table tr {

color: #00FF00;

}

</style>

</head>

<body>

<table style="width:100%">

<tr> <th>Head</th> </tr>

<tr> <td>Row</td> </tr>

</table>

</body>

</html>

</iframe>
```


author: Kirti sabade
body: Okay, I have this 400 line table code. Now please tell me where should i place this entire code if i want this to appear in confluence, exact same as way as it appears in my web browser.

And thank you so much for bearing with me. much appreciated sir :)


author: DPKJ
body: I would suggest use inline styling, and start content directly from \<table\> tag.


author: Kirti sabade
body: ![C.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/64167i08A0696A72A8A37B/image-size/large?v=v2&px=999 "C.PNG")

When i paste your sample code in \<iframe\> this what i get.


author: DPKJ
body: Better use inline styling. Try that also.

Iframe uses changes in confluence from version to version.


author: Kirti sabade
body: ![iframe.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/64169i1C660FF908FE685F/image-size/large?v=v2&px=999 "iframe.PNG")

SO in inline style, should i paste entire html code or just from \<table\> tag? if only \<table\> then where will i paste \<html\> and \<iframe\>? what will be in the URL section?

Thanks,


author: DPKJ
body: No, you need to use HTML macro only.

And put html code like this in it.

```
<table>

<tr style="border: 2px solid #333; backgroud-color: #efefef; color: #999;" ></tr>

</table>

```

Here

**style="border: 2px solid #333; backgroud-color: #efefef; color: #999;"**

is inline style for table's tr element.


author: Kirti sabade
body: Its looking like this,

![cc.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/64171i41B7FABFB29256DB/image-size/large?v=v2&px=999 "cc.PNG")

Table should rather look like this,![tt.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/64170i255A640E49E99009/image-size/large?v=v2&px=999 "tt.PNG")

Whats the ideal way to implement this,


author: DPKJ
body: So I have tried is my self, I have added this code to HTML macro

![Screenshot 2019-08-23 at 1.43.53 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/64173i17D51E0453CC1959/image-dimensions/472x237?v=v2 "Screenshot 2019-08-23 at 1.43.53 PM.png")

Which produces this output

![Screenshot 2019-08-23 at 1.44.06 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/64174iBC94DA42C1E12EDE/image-dimensions/181x176?v=v2 "Screenshot 2019-08-23 at 1.44.06 PM.png")


author: Kirti sabade
body: How come it's not working with me.. is it because i need to place images and text strings inside the table rows and columns?

okay here is my mail-id sabadekirti95@gmail.com please send hi, i will share the code snippet with you. here i could't able to share large code. would you be fine with that? otherwise also its fine.


author: Kirti sabade
body: Here is how my code looks. there are tiny images on every row and column.

![a.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/64175iD9BD18CAA1FE0334/image-size/large?v=v2&px=999 "a.PNG")


author: Kirti sabade
body: Never mind, Guess what?? It worked!! Thank you so much sir! I owe you so much..

Thank you so much for your patience and help! great day ahead!