gpt4 book ai didi

html - 使 Bootstrap 轮播图像和文本在移动设备中可读

转载 作者:行者123 更新时间:2023-11-28 05:58:18 27 4
gpt4 key购买 nike

我的 bootstrap carousel 在桌面上看起来不错。图片大小为 1200x400。但在移动设备上,它缩小得太多以至于你无法准备好图像上的文字。此外,播放器底部的导航点会向上移动到图像顶部。

1) 如何保持尺寸足够大以便在移动设备上阅读图片上的文字

2) 如何防止播放器底部的导航点与我在移动设备上的图像重叠

enter image description here

这是我的 Boot : http://www.bootply.com/huskydawgs/6UtgjHqm8f

这是我的 html:

   <div class="content-section-b">

<div class="container">

<div class="row">
<div class="col-lg-12">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
</ol>

<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive" src="http://www.onvia.com/responsive/apple_orange_testimonials.png" alt="Apples and Oranges">
</div>
<div class="item">
<img class="img-responsive" src="http://www.onvia.com/responsive/pears_mangos_testimonials.png" alt="Pears and Mangos">
</div>
</div>

<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>

</div>
<!-- /.container -->

</div>
<!-- /.content-section-b -->

这是我的CSS:

    .content-section-b {
padding: 50px 0;
background-color: #3C5A78;
}

.carousel-control.left {
background-image:none;
}

.carousel-control.right {
background-image:none;
}

最佳答案

问题出在源图像上:它们看起来好像是两个不同的旋转木马元素,而实际上只有一个(苹果橙和梨芒果)...为了快速修复,您可以来自源的单个图像(每个水果一个),通过 xs 屏幕上的媒体查询隐藏常规轮播,并有一个可见的 xs 轮播,它有 4 个而不是 2 个轮播元素。

但这不是一个很好的解决方案。

快速示例:http://www.bootply.com/U5uYwmnt1g

编辑

添加了 CSS 以在移动设备上移动导航点,使其不与幻灯片重叠。

扩展为什么它不是最佳解决方案:

-首先,您应该将轮播的元素设为 html 元素,而不是完全依赖内部带有形状和文本的图像(图像上的所有内容都可以使用 CSS 轻松复制,仅将图像用于水果,或者对于水果圆圈,如果你不喜欢用 CSS 制作圆圈的话)

-完成此操作后,您可以跳过第二个轮播并通过媒体查询(或辅助类)修改每张幻灯片的内容以获得所需的结果

-导航点的 CSS 使用 max-width 查询,据我所知,通常不推荐这样做,但在这种情况下可能会很好地使用它(如果有人可以对此进行扩展,请做)

关于html - 使 Bootstrap 轮播图像和文本在移动设备中可读,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36931164/

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