【发布时间】:2018-01-15 11:28:20
【问题描述】:
In this plunk 我有一个 Angular UI 模态框,其中一个 div 在模态框内,但由于它有 position:fixed 我希望 div 在外面并覆盖整个屏幕。为什么它在模态中以及如何使其工作?请注意,div 必须在模态框内。
HTML
<style>
.app-modal .modal-dialog {
width: 260px;
height:100px;
}
div#background {
position:fixed;
top:0;
left:0;
height:100%;
width:100%;
background-color:orange;
}
</style>
<script type="text/ng-template" id="myModalContent.html">
<div id="background"></div>
Some text in the div
</script>
【问题讨论】:
-
首先,你的身高是 1oo 而不是 100。另外,div 的文本在 div 标签之外。此外,.modal-dialog 的宽度和高度限制了 div 的宽度和高度,因为它是容器。如果你也将它们设置为 100%,你会看到它确实一直在扩展
-
谢谢。我修复了100,但仍然有同样的问题。 div 的文本在标签之外,因为它属于模态本身,而不是背景。问题是:如果位置是固定的并且顶部/左侧为零,为什么背景不是位于屏幕的顶部/左侧而不是模态?背景 div 应该是独立的,因为它的位置是
fixed。
标签: angularjs angular-ui-bootstrap angular-ui