html - 如何在手机屏幕上调整图像

标签 html css twitter-bootstrap-3

我应该如何在不同类型的屏幕上调整 slider 图像?我正在使用 Bootstrap 。

  1. 对于 slider ,如果我使用尺寸图像:1920px *1228px;它使用的是笔记本电脑屏幕的完整高度,但在移动屏幕上查看时 - 它覆盖了大约。移动屏幕的 30%。(因为移动宽度相对小于高度)。
  2. 另一方面,如果我尝试使用尺寸为 1600*400 像素的图像;在笔记本电脑屏幕上,它占据了大约 30% 的高度,根据我的网站,这看起来不错,但是有了这个,在我的移动屏幕上,它看起来又小又差。

我应该添加一些 CSS 还是其他东西?

这是我的代码。

HTML

<div id="myCarousel" class="carousel slide" data-ride="carousel">

      <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
      <li data-target="#myCarousel" data-slide-to="1"></li>
      <li data-target="#myCarousel" data-slide-to="2"></li>
      <li data-target="#myCarousel" data-slide-to="3"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
      <div class="item active">
        <img src="images/Cimg5.jpg" alt="Los Angeles" style="width:100%;">
      </div>

      <div class="item">
        <img src="images/Cimg2.jpg" alt="Chicago" style="width:100%;">
      </div>

      <div class="item">
        <img src="images/Cimg3.jpg" alt="New york" style="width:100%;">
      </div>

     <div class="item">
        <img src="images/Cimg4.jpg" alt="New york" style="width:100%;">
      </div> 

    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
      <span class="sr-only">Next</span>
    </a>

</div>   

最佳答案

在头部使用viewport然后检查。

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

关于html - 如何在手机屏幕上调整图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47993855/

相关文章:

css - 从帖子中的微笑中删除边框

css - 跨域中的 bootstrap glyphicons 不起作用

twitter-bootstrap - Bootstrap 3.1.1 - .map 扩展文件的用途是什么?

jquery - 如果短语/句子不跳到下一行,如何仅将文本设置为左对齐?

html - 在 CSS、HTML 或 Javascript 中创建可自定义的计数函数?

html - 使 parent 不扩展到 child 的内容

html - Bootstrap Collapse 折叠时显示子元素

javascript - 表单提交后,Bootstrap 选项卡会转到同一页面上的特定选项卡

html - 是否可以底部对齐图像并顶部对齐图像下方的标题?

javascript - onClick 函数导致未捕获的语法错误 : Unexpected token;