Styling tables in Community
I have been testing out some styles on tables within our Stage and Production environments that end up appearing different. I saw this older post here about something similar (although I am using inline styles instead of CSS) but this topic was older and wanted to see if there could be a solution now that might not have been available 3 years ago.
See the information & code below. Any help, tips or suggestions that you have are welcome! (I had posted this in the Support Board, but was directed to try posting here in Developer Discussion to see if there were any other suggestions)
This is my original post:
I have been playing around in our Stage environment and our Moderator's only area in production to test out adding tables as part of a signature. I have seen that some styles are showing in Stage but not in production, and in production some styles show in the Rich Text Editor but not when posted. In particular it is the border-radius that seems to not be accepted/working properly in all scenarios. Can this code not be used in a Lithium Community? Any workaround to this? I want the table to look like a button, so the rounded corners helps. Any ideas that you have are appreciated.
This is the code that I am using:
<table style="border-radius: 15px; width: 300px; background-color: #0078c1;" width="300px">
<tbody>
<tr>
<td style="background-color: #0078c1;"> *I had to add the background color to the column here for it to show in production*
<p align="center"><a style="color: #ffffff; font-color: #FFFFFF;" href="http://google.com" target="_blank">Some simple text here</a><img src="http://imageurl.jpg" border="0" width="125" /></p>
</td>
</tr>
</tbody>
</table>
Here are the differences in views - (All screenshots are taken from Chrome version 38)
I also noticed that I use similar code in one of our "Custom Alert" banners at the top of our Community on our Stage environment. The code is very similar, adding in a background image to have a gradient appear, but the border-raduis shows without issue. Due to some of the CSS of our Community, there is some additional code in that area (padding around Div tags) so that the text appears as we want it to.
This is what it looks like:
This is the code:
<table cellpadding="10" style="border-radius: 15px; background-image:url(https://backgroundimageurl.image.png); background-repeat: repeat-x; background-color: #ffbc23; font-size: 11pt; font-color: #406e98;" width="100%">
<tbody>
<tr>
<td>
<Div style="font-size: 11pt; color: #406e98; padding: 8px 5px 5px 10px;"> <b>This is a sample Alert header</b></div>
<div style="font-size: 11pt; color: #406e98; padding: 10px 5px 8px 10px;">This is sample alert text </div>
</td>
</tr>
</tbody>
</table>
I know a workaround would be to make the whole table an image & make it a clickable link. The reason a table works better is edits can be made easier within a table for small changes, like wording or the image needs to be changed or added to in the table.