CSS 模态弹出窗口中的引导表内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18147749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 23:53:19  来源:igfitidea点击:

Bootstrap table contents in a modal pop up

javascriptcssruby-on-railstwitter-bootstrap

提问by Dan Rey Oquindo

I have some formatting issues using bootstrap. I want to insert data in tabular form in modal-body. Is this possible? As i checked the sample, modal can only be used by using div tags.

我在使用引导程序时遇到了一些格式问题。我想在模态体中以表格形式插入数据。这可能吗?当我检查示例时,模态只能通过使用 div 标签来使用。

http://getbootstrap.com/javascript/#modals

http://getbootstrap.com/javascript/#modals

回答by madhead

Sure, you can use tables in modals!:

当然,您可以在模态中使用表格!

<a data-toggle="modal" href="#myModal" class="btn btn-primary btn-lg">Launch demo modal</a>

<div class="modal fade" id="myModal">
<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">
      <table>
          <thead>
          </thead>
          <tbody class="table">
              <tr>
                  <td>1</td>
                  <td>2</td>
              </tr>
              <tr>
                  <td>3</td>
                  <td>4</td>
              </tr>
          </tbody>
      </table>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    </div>
  </div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

回答by CramerTV

Yes, but I had to move my modal content to the top of the html body to get it to work correctly.

是的,但我必须将模态内容移动到 html 正文的顶部才能使其正常工作。