css - Shopify 液体模板中带有文本叠加的图像
问题描述
Shopify 的新手。我正在为我的商店编写 Express 主题的代码,不知道如何将 h1 标题作为图像叠加层。这是我需要在液体模板中编辑的部分的代码:
section class="collection__section" data-section-id="{{ section.id }}">
<div class="collection-wrapper">
<h1 class="collection__title center">{{ collection.title }}</h1>
<div class="collection-info collection-info--template">
{%- if section.settings.show_collection_image and collection.image -%}
<div class="collection-image-wrapper">
<div class="collection-image-container">
<img srcset="{% if collection.image.width >= 311 %}{{ collection.image | img_url: '311x' }} 311w,{% endif %}
{% if collection.image.width >= 622 %}{{ collection.image | img_url: '622x' }} 622w,{% endif %}
{% if collection.image.width >= 685 %}{{ collection.image | img_url: '685x' }} 685w,{% endif %}
{% if collection.image.width >= 1370 %}{{ collection.image | img_url: '1370x' }} 1370w,{% endif %}
{% if collection.image.width >= 1080 %}{{ collection.image | img_url: '1080x' }} 1080w,{% endif %}
{% if collection.image.width >= 2160 %}{{ collection.image | img_url: '2160x' }} 2160w{% endif %}"
sizes="(min-width: 1200px) 1080px, (min-width: 750px) calc(100vw - 8rem), calc(100vw - 6.4rem)"
src="{{ collection.image | img_url: '1080x' }}"
width="{{ collection.image.width }}"
height="{{ collection.image.height }}"
loading="lazy"
class="media-cover"
alt="{{ collection.title }}">
</div>
</div>
{%- endif -%}
如何让收藏标题出现在图片的中心?谢谢
解决方案
推荐阅读
- javascript - Angular 等待变量初始化
- android - SearchView 小部件文本未与工具栏的左侧/开始对齐
- automation - 无法单击删除按钮,多视图
- c - 返回枚举的名称而不是它的值
- xslt - 从 XSLT 调用 XQuery,在 XQuery 中动态构建 XSLT?
- excel - 如何检查单元格是否存在于不同工作表的范围内,然后引用它
- python - 我在循环中调用一个函数并将结果存储在一个矩阵中,我该如何并行化它?
- python - scipy中的Sobel过滤器实现
- ipython - 蟒蛇。如何在下一行继续代码?
- c# - 如何获得“jan-2018, Feb-2018, Mar-2018”作为下拉列表