弹出背景不占据屏幕高度的全高

时间:2015-07-30 12:50:29

标签: javascript css

我有一个弹出窗口,它的背景并没有达到完全高度我知道position:fixed已完成高度,但我想在移动视图中将其position:absolute取出并完全覆盖屏幕但是它不需要height:100%height:auto只提供1/2屏幕背景而不是完全100%

3 个答案:

答案 0 :(得分:2)

我想你是这样的:



.popup {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: tomato;
}

<div class="popup">I cover the whole screen!</div>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

throw true;

答案 2 :(得分:0)

记得在css中设置

html, body {
  height:100%;
}

否则,内容元素中的任何height:100%都不会涵盖所有屏幕,但会受到限制,默认情况下不会扩展