html - Bootstrap 模式中的图像问题

标签 html css twitter-bootstrap-3 modal-dialog bootstrap-modal

http://codepen.io/anon/pen/jWGXKJ

<a data-toggle="modal" href="#modal" class="btn btn-primary">Open</a>
<div id="modal" class="modal modal-wide fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
        <img src="http://i.imgur.com/aZO5Kol.jpg"/>
      </div>
    </div>
  </div>
</div>
  1. 如何让模态扩展其宽度以适应其包含的图像,而无需计算和使用图像宽度(以像素为单位)。
  2. 当模式水平延伸到当前 View 之外时,如何在窗口本身上获得水平滚动条?

最佳答案

1) 不需要像素 你可以用百分比%来做到这一点

img{
width:100%;
}

关于html - Bootstrap 模式中的图像问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34841873/

相关文章:

html - 根据屏幕大小调整字体大小

twitter-bootstrap - Bootstrap 日期选择器配置以阻止特定日期(节假日)

javascript - 通过已知半径 2D 的圆缠结点在 html Canvas 中绘制圆弧以适合 Angular

css - Bootstrap 4 网格在列方向上不遵守 col-*

html - 如何为单个边框设置多种颜色

css - 创建一个带有 3 条水平虚线或线条的 Bootstrap 3 按钮

html - 使用 iTextSharp 使用 HTML 格式的文本填充 PDF 模板 acrofield

html - 在放大弹出窗口中垂直对齐图像

javascript - 当 localStorage 为 null 时,为什么它仍然像有键和值一样工作?

java - INPUT box-sizing border-box with 100% height and width inside TD issue in Chrome