gpt4 book ai didi

html - AMP-Carousel 中的字幕不起作用

转载 作者:行者123 更新时间:2023-11-27 23:04:02 25 4
gpt4 key购买 nike

我添加标题 <div class="caption">在我的 amp-carousel 旁边 amp-img .当设备变成移动设备时,标题看起来是半隐藏的。

enter image description here

这是我的代码:

<amp-carousel autoplay='' delay='6000' height='340' layout='responsive' type='slides' width='824'>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='image-link-here' width='824'/>
<div class='caption'>
<p class='text-inside'><em>Pertama</em>, kode yang ditulis dalam membangun website anda harus tervalidasi menggunakan versi HTML, PHP atau CSS kompatibel atau terupdate sehingga mesin pencari dapat melakukan <em>crawling website</em> anda.</p>
</div>
</div>

</div>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='image-link-here' width='824'/>
<div class='caption'>
<p class='text-inside'><em>Kedua</em>, loading speed website harus cepat, aman dan <em>mobile friendly</em> (responsive sesuai device yang digunakan semua user).</p>
</div>
</div>
</div>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='image-link-here' width='824'/>
<div class='caption'>
<p class='text-inside'><em>Ketiga</em>, konten website anda harus unik, berguna/bermanfaat bagi visitor dan teroptimasi (on page SEO) atau SEOptin sebut sebagai <b>website UMT</b> (<em>Unik, Manfaat, Teroptimasi</em>).</p>
</div>
</div>
</div>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='image-link-here' width='824'/>
<div class='caption'>
<p class='text-inside'><em>Keempat</em>, tulisan di konten website anda sudah diakui (UMT) oleh website yang relevan (sama niche) atau website terbaik lainnya seperti wikipedia, website edu dsb.</p>
</div>
</div>
</div>
</amp-carousel>

在 CSS 中:

amp-carousel{
margin-bottom:25px;
}
p.text-inside{
background:#fff;
padding:15px;
border-radius:0px 0px 3px 3px;
border-left:1px solid #DEDEDE;
border-right:1px solid #DEDEDE;
border-bottom:1px solid #DEDEDE;
font-family:&quot;Tahoma&quot;,sans-serif;
font-size:14px;
letter-spacing:1px;
color:#777;
}
p.text-inside em,p.text-inside strong,p.text-inside b{
font-family:&quot;Tahoma&quot;,sans-serif;
font-size:14px;
letter-spacing:1px;
color:#444;
}

Live preview

最佳答案

在这种情况下使用 amp-fit-text

amp-fit-text : Expands or shrinks its font size to fit the content within the space given to it.

代码

<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<link rel="canonical" href="carousel.html">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
<script async custom-element="amp-fit-text" src="https://cdn.ampproject.org/v0/amp-fit-text-0.1.js"></script>
<style amp-custom>
amp-carousel{
margin-bottom:25px;
}
p.text-inside{
background:#fff;
padding:15px;
border-radius:0px 0px 3px 3px;
border-left:1px solid #DEDEDE;
border-right:1px solid #DEDEDE;
border-bottom:1px solid #DEDEDE;
font-family:&quot;Tahoma&quot;,sans-serif;
font-size:14px;
letter-spacing:1px;
color:#777;
}
p.text-inside em,p.text-inside strong,p.text-inside b{
font-family:&quot;Tahoma&quot;,sans-serif;
font-size:14px;
letter-spacing:1px;
color:#444;
}
</style>
</head>
<body>
<amp-carousel controls autoplay='' delay='6000' height='440' layout='responsive' type='slides' width='824'>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='https://dummyimage.com/840x240/000/f00' width='824'/>
<amp-fit-text layout="responsive"
width="824"
height="200">
<div class='caption'>
<p class='text-inside'><em>Pertama</em>, kode yang ditulis dalam membangun website anda harus tervalidasi menggunakan versi HTML, PHP atau CSS kompatibel atau terupdate sehingga mesin pencari dapat melakukan <em>crawling website</em> anda.</p>
</div>
</amp-fit-text>
</div>

</div>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='https://dummyimage.com/840x240/000/0f0' width='824'/>
<amp-fit-text layout="responsive"
width="824"
height="200">
<div class='caption'>
<p class='text-inside'><em>Kedua</em>, loading speed website harus cepat, aman dan <em>mobile friendly</em> (responsive sesuai device yang digunakan semua user).</p>
</div>
</amp-fit-text>
</div>
</div>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='https://dummyimage.com/840x240/000/00f' width='824'/>
<amp-fit-text layout="responsive"
width="824"
height="200">
<div class='caption'>
<p class='text-inside'><em>Ketiga</em>, konten website anda harus unik, berguna/bermanfaat bagi visitor dan teroptimasi (on page SEO) atau SEOptin sebut sebagai <b>website UMT</b> (<em>Unik, Manfaat, Teroptimasi</em>).</p>
</div>
</amp-fit-text>
</div>
</div>
<div>
<div>
<amp-img alt='' height='240' layout='responsive' src='https://dummyimage.com/840x240/000/fff' width='824'/>
<amp-fit-text layout="responsive"
width="824"
height="200">
<div class='caption'>
<p class='text-inside'><em>Keempat</em>, tulisan di konten website anda sudah diakui (UMT) oleh website yang relevan (sama niche) atau website terbaik lainnya seperti wikipedia, website edu dsb.</p>
</div>
</amp-fit-text>
</div>
</div>
</amp-carousel>
</body>
</html>

Example Here

更多引用请访问:

  1. amp-fit-text

  2. Image Galleries with amp-carousel

关于html - AMP-Carousel 中的字幕不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50938853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com