我只是想在iphone 5/6设备上制作一个非常高的自举模式显示器。
我无法让这件事适合任何事情。我试过在模态内容和模态对话框中增加高度,但它不会工作。
那里有任何简单的解决方案吗?
.modal-dialog{
height:90% !important;
}

<div class="container">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch modal
</button>
</div>
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">My modal</h4>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
&#13;
答案 0 :(得分:3)
.modal-content
块位于.modal-dialog
块内。因此,告诉孩子与父母的身高相同。尝试:
.modal-dialog {
height: 90%; /* = 90% of the .modal-backdrop block = %90 of the screen */
}
.modal-content {
height: 100%; /* = 100% of the .modal-dialog block */
}
检查:
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
.modal-tall .modal-dialog {
height: 90%;
}
.modal-tall .modal-content {
height: 100%;
}
/* fix SO stick navigation ;) */
@media (min-width: 768px) { body { padding-top: 75px; } }
<div class="container">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#modalDefault">
Default modal
</button>
<button type="button" class="btn btn-warning btn-lg" data-toggle="modal" data-target="#modalTall">
Tall modal
</button>
</div>
<div id="modalDefault" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Default modal</h4>
</div>
</div>
</div>
</div>
<div id="modalTall" class="modal modal-tall fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal has 90% height</h4>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
答案 1 :(得分:0)
那是因为模型在类modal-content
内,我不知道你的代码是怎么样的,如果你的内容有一些参考,现在你可以以像素为单位:
.modal-content{
height:500px;
}