【发布时间】:2018-09-03 14:58:13
【问题描述】:
我正在尝试按照link 中提供的答案使用 Jade mixins 进行内联样式设置,但它并没有按照预期的方式工作。
我在用这个玉:
mixin centerImg(margin,imgWidth,imgWidthpx,imgId)
table(border="0", cellpadding="0", cellspacing="0", width="640")
tr
td(width=margin)
td(width=imgWidth)
a.antiHand(href='#', style='cursor: none !important; pointer-events: none; border-style: none; border: none; border-color: transparent;')
img(alt="", style="width:#{imgWidth};max-width:#{imgWidthpx};display:block;margin:0")(width=imgWidth)(src=imgId)
td(width=margin)
+centerImg(200,240,"240px",'https://media.giphy.com/media/SzzNGHZWHCBqw/giphy.gif')
这就是我得到的:
<table border="0" cellpadding="0" cellspacing="0" width="640">
<tr>
<td width="200"></td>
<td width="240"><a class="antiHand" href="#" style="cursor: none !important; pointer-events: none; border-style: none; border: none; border-color: transparent;"><img alt="" style="width:#{imgWidth};max-width:#{imgWidthpx};display:block;margin:0" width="240" src="https://media.giphy.com/media/SzzNGHZWHCBqw/giphy.gif"/></a></td>
<td width="200"></td>
</tr>
</table>
有什么想法吗?
【问题讨论】:
-
mixin 的内容应该比
mixin声明的缩进级别大一级。现在,它们处于同一级别。
标签: email pug html-email mixins