Tôi là một chút muộn để các trò chơi nhưng hy vọng điều này sẽ giúp một ai đó .
Tôi thấy điều này tốt đẹp chút jQuery/javascript phương pháp có thể được nhúng vào một trang - http://devintorr.es/blog/2010/05/26/turn-css-rules-into-inline-style-attributes-using-jquery/
tôi đã chỉnh sửa nó một chút để hỗ trợ trình duyệt IE và cũng để hỗ trợ một trang với nhiều file CSS gắn liền áp dụng phong cách trong đúng thứ tự.
$(document).ready(function ($) {
var rules;
for(var i = document.styleSheets.length - 1; i >= 0; i--){
if(document.styleSheets[i].cssRules)
rules = document.styleSheets[i].cssRules;
else if(document.styleSheets[i].rules)
rules = document.styleSheets[i].rules;
for (var idx = 0, len = rules.length; idx < len; idx++) {
if(rules[idx].selectorText.indexOf("hover") == -1) {
$(rules[idx].selectorText).each(function (i, elem) {
elem.style.cssText = rules[idx].style.cssText + elem.style.cssText;
});
}
}
}
$('style').remove();
$('script').remove();
$('link').remove();
});
Sau đó, trang có thể được sao chép/dán vào nội dung email.
Nguồn
2013-05-24 13:54:00
Tôi vừa hỏi một câu hỏi tương tự trên khuyến nghị Software as a sau -Đối với điều này: http://softwarerecs.stackexchange.com/questions/9983/tool-to-automatically-inline-both-css-and-javascript-into-html –
Tôi chỉ phải giải quyết điều này chính xác cho một bộ phận tại nơi làm việc. Câu hỏi này cung cấp các bước cần thiết để giải quyết vấn đề. – Gopherkhan