我在<div class="caption">
旁边的安培转盘中添加标题amp-img
。当设备变为移动设备时,字幕看起来隐藏了一半。
这是我的代码:
<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:"Tahoma",sans-serif;
font-size:14px;
letter-spacing:1px;
color:#777;
}
p.text-inside em,p.text-inside strong,p.text-inside b{
font-family:"Tahoma",sans-serif;
font-size:14px;
letter-spacing:1px;
color:#444;
}
答案 0 :(得分:2)
在这种情况下,请使用amp-fit-text
amp-fit-text:扩展或缩小其字体大小以适合内容 在给定的空间内。
代码
<!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:"Tahoma",sans-serif;
font-size:14px;
letter-spacing:1px;
color:#777;
}
p.text-inside em,p.text-inside strong,p.text-inside b{
font-family:"Tahoma",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>
有关更多参考信息,请访问: