【问题标题】:AMP-carousel required heightAMP-carousel 所需高度
【发布时间】:2019-04-29 15:31:42
【问题描述】:

我有一个 amp-carousel,其中包含 div 的幻灯片,每个幻灯片都有不同数量的文本(不是图像)。

由于每张幻灯片中的文本数量不同且高度固定,我无法获得响应的比率。所以我要么在下面显示所有带有大空格的文本,要么将文本截掉。

我正在尝试实现旋转木马的高度将根据其中的内容进行调整。

我尝试了其他布局,结果相同。

有人有办法解决这个问题吗?

<amp-carousel height="180" width="790" layout="responsive" type="slides">
      <div class="review">   
           1 paragraphs of text
      </div>
      <div class="review">   
           5 paragraphs of text
      </div>
      <div class="review">   
           4 paragraphs of text
      </div>
</amp-carousel>

【问题讨论】:

    标签: amp-html


    【解决方案1】:

    之所以必须指定轮播高度,是为了防止内容根据所选页面跳到轮播下方,因此无法避免。

    一种解决方法是固定高度并使用amp-fit-text

    <amp-carousel height="500" layout="fixed-height" type="slides">
      <div class="review">
        <amp-fit-text height="500" layout="responsive">
          1 paragraphs of text
        </amp-fit-text>
      </div>
      <div class="review">
        <amp-fit-text height="500" layout="responsive">
          5 paragraphs of text
        </amp-fit-text>
      </div>
      <div class="review">
        <amp-fit-text height="500" layout="responsive">
          4 paragraphs of text
        </amp-fit-text>
      </div>
    </amp-carousel>
    

    这允许您将文本垂直居中、修改文本大小和/或根据内部文本的数量将其截断。

    【讨论】:

      猜你喜欢
      • 2022-12-19
      • 2019-09-04
      • 2018-12-30
      • 2015-12-28
      • 1970-01-01
      • 2015-02-25
      • 2016-09-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多