简体   繁体   English

CSS不会填充视图端口

[英]CSS won't fill view port

I have a div overlay which pops up when a link is clicked, my problem is you have to scroll to click the link, then the overlay remains at the top of the page instead of the area the user is currently looking at. 我有一个div叠加层,单击链接时会弹出,我的问题是您必须滚动单击链接,然后该叠加层仍位于页面顶部,而不是用户当前正在查看的区域。

You can see it here by scrolling down and clicking on any of the links eg 'multiple orders 'here' and the terms and conditions at the bottom. 您可以通过向下滚动并单击任何链接(例如“此处的多个订单”以及底部的条款和条件)在此处查看。

Here is the CSS: 这是CSS:

  .black_overlay{
        display: none;
        position: absolute;
        /*top: 0%;
        left: 0%;
        width: 100%;
        height: 1000px; */
        top: 0px;
        right: 0px;
        left: 0px;
        bottom: 0px;
        height: 100%;


        background-color: black;
        z-index:1001;
        -moz-opacity: 0.8;
        opacity:.80;
        filter: alpha(opacity=80);
   }
 .white_content {
        display: none;
        position: absolute;
        top: 25%;
        left: 25%;
        width: 50%;
        height: 50%;
        padding: 16px;
        border: 5px solid blue;
        background-color: white;
        z-index:1002;
        overflow: auto;
  }

And the JavaScript: 和JavaScript:

<a href = "javascript:void(0)" onclick =    "document.getElementById('light3').style.display='block';document.getElementById('fade').style.display='block'">here</a>

使用position: fixed在叠加层元素( .black_overlay.white_content )上,而不是position: absolute;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM