In a plugin: How do I set table cell widths ?
-
Hi,
I’m creating a plugin, which has a loop of data,
…and this data is displayed correctly,
…as a list, in a WordPress Page, via a ‘shortcode’ eg: [my_list]But I wish to display this list in a table.
So in a test (non wordpress) php page:
In php code, I’ve created a table, which works OK, ie:$output = ‘ <table style=”width:100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td style=”width:100%” colspan=”3″>?</td>
</tr>
<tr>
<td style=”width:10%”>?</td>
<td style=”width:45%”>?</td>
<td style=”width:45%”>?</td>
</tr>
</table>’;So this table has:
2 rows
top row: one cell @ 100%
2nd row: 3 cells @ 10% + 45% + 45%[ 100% ]
[10%][ 45% ][ 45% ]BUT when I copy this into my plugin:
It wont display the first-cell at 10%
…instead: it displays all 3 cells at the same width (ie: 33%)[ 100% ]
[ 33% ][ 33% ][ 33% ]HOWEVER:
If I just remove the top row, so that I just have the second row,
then its proportions display correctly, ie:[10%][ 45% ][ 45% ]
I’ve also found that certain style-sheets (in the WordPress-pages theme) seem to be causing the problem, but I thought that my tables inline-style-settings should over-ride any earlier styles in the style sheet !
So what’s going on ??
NB: I’m using: WordPress V:4.2.2 / theme: twentyfifteen
Many thanks. Mac
- The topic ‘In a plugin: How do I set table cell widths ?’ is closed to new replies.