AMP 轮播要求的高度

AMP-carousel required height

我有一个 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-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>

这允许您将文本垂直居中,修改文本大小 and/or 根据里面的文本量将其剪掉。