css style与class之间的区别,cssclass_html/css_WEB-ITnose
Jun 24, 2016 am 11:38 AM
问题描述:
网页点击【导出】按钮后,将页面table内容另存成excel文件,却发现无法保存表格样式
分析过程:
1.table表格用class,而不是style。导出时并没有导出class定义,若换成style,将颜色样式直接写在style中,就会导出样式。
style是样式,在HTML中用这个来标明属性样式,是css中的内容,而class是类,申明和定义里面的内容,导出页面时并不会导出定义即class所定义的样式。
2.将类定义放到table中也可以导出样式
解决方法-:
将class="${getClass()}"换成style="color:${getStyle()};"
补充:
$('#export').click(function () {
saveAsExcel($('h3').text(), $('#table').html().replace(/( )+/gi,''));
});
其中excel只识别table,使用saveAsExcel方法自动另存时,class定义保存不了;如果手工拷贝粘贴到excel时,class定义就能保存了。
主要还是手工与自动拷贝粘贴问题
网页设计
解决方法二:
将在
中定义的类移动到

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?

How do I use HTML5 form validation attributes to validate user input?

What is the purpose of the <iframe> tag? What are the security considerations when using it?

How to efficiently add stroke effects to PNG images on web pages?

What is the purpose of the <meter> element?

What are the best practices for cross-browser compatibility in HTML5?

What is the purpose of the <datalist> element?

What is the purpose of the <progress> element?
