问题
I am loading a page with table in a generated div in jquery. The loading goes fine, but the table loses its styles. I have tried to apply styles on the loaded page, on the landing page, and even inline styles on the table. The inline style works partially, like background color, but text doesn't allow me to change font type, size, weight.
$('<div/>', {
id: 'newdiv',
}).appendTo('body');
$('#newdiv').load('combi/page.with.table.php');
The table is simplified. No styles on tr or td.
<table style="font-size:x-large; font-family:'Courier New', Courier, monospace; text-align:right; background:#0F0" width="800" border="1" cellspacing="3" cellpadding="3">
</table>
回答1:
If you are using a stylesheet to control the style of the table, make sure the stylesheet is in a path relative to the loaded page and not the page which is being loaded.
来源:https://stackoverflow.com/questions/9134451/loading-table-dynamically-loses-style-rules