css - 使用 Bootstrap 在表中响应图像

标签 css twitter-bootstrap

我有

----------------
     header
----------------
| t1 | t2 | t3 |
----------------
| i1 | i2 | i3 |

我需要(通过 Bootstrap 或直接 css)底部图像“响应”(根据内容宽度调整大小)

这是我的代码 (Plunker here)。 我在 td 上尝试了 width:100%; ,在 img 上尝试了 img-responsive,但没有成功.

  <link data-require="bootstrap@*" data-semver="4.0.5" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
  <script data-require="bootstrap@*" data-semver="4.0.5" src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js"></script>

  <table style="width:100%">
    <thead>
      <tr>
        <th colspan=3 class="text-center">My Pics</th>
      </tr>
      <tr>
        <th class="text-center">Trees</th>
        <th class="text-center">Cats</th>
        <th class="text-center">Bulding</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td style="width:100%;" class="text-center"><img class="img-responsive" src="https://unsplash.it/164/90"/></td>
        <td style="width:100%;" class="text-center"><img class="img-responsive" src="https://unsplash.it/164/91"/></td>
        <td style="width:100%;" class="text-center"><img class="img-responsive" src="https://unsplash.it/164/92"/></td>
      </tr>
    </tbody>
  </table>

最佳答案

img-responsive 已更改为 img-fluid 所以也许先尝试一下( Bootstrap 类)。

关于css - 使用 Bootstrap 在表中响应图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43004215/

相关文章:

css - GitHub 页面加载 Bootstrap CSS,但不是我的自定义样式表?

node.js - Bootstrap 字形(fonts/****.woff)未加载

html - Bootstrap 3.0 内联标题标签

html - 如何将图像设置为 div 的背景并将其 "ZOrder"设置为 0?

html - 在不增加尺寸的情况下向 Bootstrap 网格添加边距

javascript - 结合 SVG 动画的绘制、旋转和绘制

CSS - 在最后一个 nth-child 动画结束后重复动画

css - 删除(不是搜索!)未使用的基于 Dust-Me 的 CSS 选择器

python - 使用 Select2 和 Bootstrap 样式的问题

javascript - 如何使用 jQuery 打开 Bootstrap 模式窗口?