html - 通过属性 mixin jade 的内联样式

标签 html css node.js pug

有没有办法通过 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/

相关文章:

javascript - 减少 CSS 中的上传按钮大小

html - Wordpress CSS 列索引

javascript - 使用 javascript 覆盖和求和价格

html - 垂直对齐具有动态主体高度和宽度的div

html - 更改后端 html wordpress

javascript - 滚轮并不总是滚动页面

css - 没有 www 的 FontAwesome 不显示

node.js - React.js - 在 onclick() 事件上从签名的 S3 url 下载文件

javascript - webpack 和在同构包中使用 Node 模块

javascript - 通过 Sails.js 服务器的 Angular.js Web 应用程序