【问题标题】:grav cms materilaize.css img caption in twiggrav cms materialize.css figcaption in twig
【发布时间】:2018-11-26 10:26:45
【问题描述】:

我正在使用带有 materilaize.css 的 Grav Cms。对于图片标题,我需要在物化中使用以下 html 语法:

<img class="materialboxed" 
     data-caption="A picture of a way with a group of trees in a park" 
     src="https://lorempixel.com/800/400/nature/4"
>

在树枝中,我一般使用以下内容:

{{ image.html('', '', 'materialboxed responsive-img card') }}

但我不知道如何将data-caption 元素添加到这一行?

【问题讨论】:

    标签: twig materialize grav


    【解决方案1】:

    最好的方法是使用url 函数而不是html,因为它在修改实际元素时提供了更大的灵活性。

    <img src="{{ image.src }}" 
      class="materialboxed responsive-img card" 
      data-caption="A picture of a way with a group of trees in a park"
    >
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-10
      • 1970-01-01
      • 1970-01-01
      • 2018-07-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多