css - 相对于在 firefox 和 chrome 上工作不同的父级的大小

标签 css twitter-bootstrap

我正在使用 Bootstrap 中的 .h-75 来调整图像相对于其父 div 的大小。在 Firefox 上调整大小有效,但在 Chrome 上它似乎忽略了它。

我尝试添加 object-fit:cover 但没有成功。

  <div class="container d-flex flex-column min-vh-100">
    <div>
      Some objects
    </div>
    <div class="mb-3" style="max-height: 50vh;">
      <img src="./img/mmm.png" class="d-none d-sm-inline h-75">
      <p class="mt-1 lead">some text</p>
    </div>
    <div>
      Some objects
    </div>
  </div>

我希望 chrome 在我像 firefox 一样缩小视口(viewport)时动态调整图像大小。

最佳答案

    Solution: ->
    Insted of using h-75 class, you can try img-fluid class to <img> tag...it adjust automatically according to viewport.

    <div class="container d-flex flex-column min-vh-100">
        <div>
          Some objects
        </div>
        <div class="mb-3" style="max-height: 50vh;">
          <img src="./img/mmm.png" class="d-none d-sm-inline img-fluid">
          <p class="mt-1 lead">some text</p>
        </div>
        <div>
          Some objects
        </div>
      </div>

You can try this...

关于css - 相对于在 firefox 和 chrome 上工作不同的父级的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56764585/

相关文章:

html - 防止 CSS 引用在移动设备上换行

javascript - Bootstrap 模态未正确关闭(模态中的模态)

c# - 带有 asp.net 文本框的 Bootstrap 输入组件

javascript - css 图像 Sprite 到鼠标功能上的 javascript

css - 无论页面大小如何,如何将两个元素彼此相邻放置

CSS 文本对齐问题

javascript - 单击父菜单时如何将 + 更改为 -

twitter-bootstrap - Bootstrap 按钮 : left icon and centered text

html - 100% 宽度行中的不同尺寸图像

html - 如何使用 search_block_form 在 drupal 中生成 Bootstrap 表单