有没有办法通过 Jade 中的 mixin 属性声明 CSS 宽度内联?下面是我尝试过的示例...
mixin button(buttonLink, buttonText, buttonWidth)
+link(buttonLink)(style='width:"buttonWidth"')
font(style='color: #ffffff; text-decoration: none;')
=buttonText
谢谢。
最佳答案
是的,这是可能的;)
mixin button(buttonLink, buttonText, buttonWidth)
+link(buttonLink)(style="width:#{buttonWidth}")
font(style='color: #ffffff; text-decoration: none;')
=buttonText
mixin link(buttonLink)
a(src=buttonLink, style=attributes.style)
block
+button("http://github.com", "github", 10)
顺便说一句:不要使用 <font>
https://developer.mozilla.org/de/docs/Web/HTML/Element/font
关于html - 通过属性 mixin jade 的内联样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25851294/