我有以下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>
答案 0 :(得分:69)
如果您使用的是bootstrap 3.0,请在此处添加答案。在bootstrap 3.0中,row-fluid
替换为row
,span
替换为col-md
(完整更改日志here)
所以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>
答案 1 :(得分: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>
答案 2 :(得分:9)
编辑:这只是纯CSS 解决方案,如果您想要更多 bootstraptic ,请查看以下答案。
你可以使用一些css将模态体分成两部分,就像你做两列的页面布局一样简单。
...
<div class="modal-body>
<div class="first-column">
<!-- Your first column here -->
</div>
<div class="second-column">
<!-- Your second column here -->
</div>
</div>
...
和CSS
.first-column {
width: 40%;
float: left;
}
.second-column {
width: 40%;
float: right;
}
不需要在模态中使用网格系统,如果你尝试使用跨度,可能结果会更糟。