为了解决 Outlook 中不必要的差距,我正在尝试将样式属性:添加
mso-table-lspace:0pt !important;mso-table-rspace:0pt !important;
到表格元素中。我尝试了以下方法:
- $(element).css('mso-table-lspace', '0pt');
- element.style.setProperty('mso-table-lspace', '0pt');
- element.setAttribute('style', 'mso-table-lspace:0pt;mso-table-rspace:0pt;');
- var sheet = document.createElement('style')
sheet.innerHTML = "table {mso-table-lspace:0pt !important;mso-table-rspace:0pt !important;}";
var firstEl = document.body.firstChild;
document.body.insertBefore(sheet, firstEl)
- element.style.msoTableLspace = "0pt";
但没有任何影响结果的html。属性不会添加到表格样式中。我会很感激帮助。