如何将Twitter引导模式分为两部分

Sau*_*mar 18 twitter-bootstrap twitter-bootstrap-2

在此输入图像描述

我有以下HTML

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-body">
        <table>
            <tbody>
                <tr>
                    <td>
                        <div class="span2 fileupload fileupload-new pull-left" data-provides="fileupload">
                            <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
                            <div> <span class="btn btn-file"><span class="fileupload-new">Select image</span>
                                <span
                                class="fileupload-exists">Change</span>
                                    <input type="file" />
                                    </span> <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>

                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="progress">
                            <div class="bar" style="width: 60%;"></div>
                        </div>
                        <button class="btn btn-mini" type="button">Upload</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</button>
    </div>

</div>
Run Code Online (Sandbox Code Playgroud)

int*_*skh 70

如果您使用的是bootstrap 3.0,请在此处添加答案.在引导3.0,row-fluid被替换rowspan被替换col-md(完全改变日志这里)

所以Eduardo Grajeda的答案就变成了

<div class="modal-body row">
  <div class="col-md-6">
    <!-- Your first column here -->
  </div>
  <div class="col-md-6">
    <!-- Your second column here -->
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)


小智 13

只是想补充一点,我设法使用Bootstrap提供的CSS来做到这一点.以下代码对我有用:

<div class="modal-body row-fluid">
  <div class="span6">
    <!-- Your first column here -->
  </div>
  <div class="span6">
    <!-- Your second column here -->
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)


Pig*_*ras 9

编辑:这只是一个纯粹的CSS解决方案,如果你想要更具引导性的东西,请查看下面的答案.


你可以使用一些css将模态体分成两部分,就像你做两列的页面布局一样简单.

...
<div class="modal-body>
   <div class="first-column">
       <!-- Your first column here -->
   </div>
   <div class="second-column">
       <!-- Your second column here -->
   </div>
</div>
...
Run Code Online (Sandbox Code Playgroud)

和CSS

.first-column {
  width: 40%;
  float: left;
}

.second-column {
  width: 40%;
  float: right;
}
Run Code Online (Sandbox Code Playgroud)

没有必要在模态中使用网格系统,如果你尝试使用跨度,可能结果会更糟.

  • 使用网格系统更为理想.特别是如果你使用`modal-lg`.很可能由于移动设备,平板电脑等,您将拥有备用视图尺寸,这是*网格组件*的目的.将`.row`类应用于像@interskh建议的`模态体'是目前最好的做法.这个答案是正确的,但忽略了Bootstraps的目的. (3认同)