Home > Article > Web Front-end > The difference between css style and class_html/css_WEB-ITnose
Problem description:
After clicking the [Export] button on the web page, the page table will be The content was saved as an excel file, but it was found that the table style could not be saved
Analysis process:
1. The table table uses class instead of style. The class definition is not exported when exporting. If you change to style and write the color style directly in style, the style will be exported.
Style is the style. This is used in HTML to indicate the attribute style. It is the content in css, and class is the class, which declares and defines the content. When exporting the page, the definition will not be exported, that is, the definition of class. style.
2. Put the class definition in the table and you can also export the style
Solution-:
Replace class="${getClass()}" with style= "color:${getStyle()};"
Supplementary:
$('#export').click(function () {
saveAsExcel($('h3') .text(), $('#table').html().replace(/( ) /gi,''));
});
where excel only recognizes table, When using the saveAsExcel method to automatically save, the class definition cannot be saved; if manually copied and pasted into excel, the class definition can be saved.
It is mainly a matter of manual and automatic copy and paste
Solution 2:
Will be in
Just move the classes defined in