简体   繁体   English

解析 HTML 页面,包括所有 css styles

[英]Parse HTML Page, include all css styles

I want to send a complete html page as an email and want to include all the css styles into the email. I want to send a complete html page as an email and want to include all the css styles into the email. Is there any library that creates me one html page with all the css styles correctly included.是否有任何库可以为我创建一个 html 页面,其中正确包含所有 css styles。 (Conside you can import css files which also have to be opened and included.) (考虑到您可以导入 css 文件,这些文件也必须打开并包含在内。)

Any help is appreciated.任何帮助表示赞赏。

You could try using this: http://martinnormark.com/move-css-inline-premailer-net你可以尝试使用这个: http://martinnormark.com/move-css-inline-premailer-net

Im in the process of testing it myself in order to generate some Word documents with inline styles...i will add the results later...我正在自己测试它,以便生成一些带有内联 styles 的 Word 文档...我稍后会添加结果...

Update: It works althought Word 2010 applies some of the inline styles as it likes...didnt try with previous versions of word更新:尽管 Word 2010 应用了一些内联 styles ,但它可以工作...没有尝试使用以前版本的 word

The closest I came to this was having to send a control without includes, and I built this as a server control, read the css files ( and js files ) and write them out.我最接近这个的是必须发送一个不包含的控件,我将它构建为一个服务器控件,读取 css 文件(和 js 文件)并将它们写出来。 However for an entire page, you might have more difficulty.但是对于整个页面,您可能会遇到更多困难。

I do not believe that there is anything to do this.我不相信有什么可以做的。 If you can read the entire page code, doing find and replaces may be your easiest answer.如果您可以阅读整个页面代码,那么查找和替换可能是您最简单的答案。 Find the csss tag, replace the inner contents with the values from the file in the tag.找到 csss 标签,用标签中文件的值替换内部内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM