在液体中,“ w”和“ x”的单位是什么?

时间:2019-07-03 18:38:16

标签: liquid

我正在修改一些Shopify Liquid代码,并看到以下对我来说没有意义的单元:1600x 1600w

我假设“ w”是指宽度,但是这些像素吗?然后我不知道“ x”是什么意思。

<img  alt="{{ section.settings.image.alt }}"
          {% if section.settings.image != nil %}
            src="{{ section.settings.image | img_url: '100x' }}"
            data-src="{{ section.settings.image | img_url: '2048x' }}"
            class="lazyload lazyload--fade-in hsContainer__image"
            sizes="100vw"
            srcset="  {{ section.settings.image | img_url: '2048x' }} 2048w,
                      {{ section.settings.image | img_url: '1600x' }} 1600w,
                      {{ section.settings.image | img_url: '1200x' }} 1200w,
                      {{ section.settings.image | img_url: '1000x' }} 1000w,
                      {{ section.settings.image | img_url: '800x' }} 800w,
                      {{ section.settings.image | img_url: '600x' }} 600w,
                      {{ section.settings.image | img_url: '400x' }} 400w"
          {% else %}
            src="{{ 'placeholder.svg' | asset_url }}"
            class="hsContainer__image"
          {% endif %}
           />

1 个答案:

答案 0 :(得分:1)

“ w”是指图像的宽度,作为srcset的参数,如下所述: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Example_3_Using_the_srcset_attribute

x用作定义宽度和高度参数的字符,如下所示: https://help.shopify.com/en/themes/liquid/filters/url-filters#size-parameters

HTH