HTML table in user macro not respecting inline style

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Inline styling for HTML tables is not being respected.  It is actually being stripped out and replaced with the following:

<table width="100%">
	<tr valign="middle">
		<td width="34">
			<ac:image><ri:attachment ri:filename="$paramicon" /></ac:image>
		</td>
		<td>
			<div class="tabletitle">$paramheading</div>
		</td>
	</tr>
</table>

 

It is then processed into:

<table class="confluenceTable">
<tbody>
	<tr>
		<td class="confluenceTd">
			<img class="confluence-embedded-image" src="<path_to_attachment>" data-image-src="<path_to_attachment>">
		</td>
		<td class="confluenceTd">
			<div class="tabletitle">Boosh</div>
		</td>
	</tr>
</tbody>
</table>

Workaround

We can get the styling we want by injecting style directly into the user macro. This will give us the handles we need to affect styling that will not be stripped out when the macro is rendered.

<style type="text/css">
table.wide_table{width: 100%;}
table.wide_table .image_cell{width: 34px;}
</style>
 
<table class="wide_table">
<tbody>
	<tr>
		<td class="image_cell">
			<img class="confluence-embedded-image" src="<path_to_attachment>" data-image-src="<path_to_attachment>">
		</td>
		<td>
			<div class="tabletitle">Boosh</div>
		</td>
	</tr>
</tbody>
</table>

 

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.