.html outputs HTML tags properly except <style>

I have a very simple, single line of Wix code that uses the .html property to add both style tags and an HTML table to my page. However, Wix code is only adding half of the line to the final output (the HTML table) and is incorrectly omitting the first half (the style tags ).

Note: I cannot use an HTML component as a workaround for this, because that does not place the tags directly on the page but instead in an I-frame. And the whole reason for needing this is that a (non-Wix) competitor has edged me out of the first spot on Google, using the “HTML Table Tags for Google Rich Snippets” technique, which requires placing HTML table tags directly on the page: Keyword Rank Checker | Track Google Rankings . So I was recommended by support to use Wix code for this, but then ran into this issue.

Here is the line of code :

$w.onReady(function () {

$w('#txtList').html = '<style>table.blueTable{font-family:"Lucida Sans Unicode","Lucida Grande",sans-serif;border:1px solid #fdfeff;background-color:#5c9ed2;width:350px;text-align:left;border-collapse:collapse}table.blueTable td,table.blueTable th{border:1px solid #fff;padding:3px 2px}table.blueTable tbody td{font-size:13px}table.blueTable tr:nth-child(even){background:#97c7f5}table.blueTable tfoot td{font-size:18px}table.blueTable tfoot .links{text-align:right}table.blueTable tfoot .links a{display:inline-block;background:#1c6ea4;color:#fff;padding:2px 8px;border-radius:5px}</style><table class=blueTable><tr class=footableOdd><th>Minimum (USD)<td>$1000<tr class=footableEven><th>Type<td>Residential<tr class=footableOdd><th>Capital stack<td>Debt<tr class=footableEven><th>Volume<td>Lower<tr class=footableOdd><th>Fees<td>Higher<tr class=footableEven><th>Bankruptcy protection<td>Yes</table>';


Here is the output. First the HTML source, where you can see that only half of the string was actually added by Wix code. The table tags are there, but the style tags right before it are missing:

The problem is also evident in the way it looks when rendered to the browser. Here you can see the result where the HTML

tags were rendered, but not the .

In comparison here is the exact same HTML shown by itself without WIX code (this is what is seen when the style tags are actually rendered):

Wix .html property only allows a subset of html. The subset is documented here - www.wix.com/code/reference/$w.Text.html

Notice that the style element is not allowed. You can still use inline styles (the style attribute)

1 Like