weixin_33725272 2010-12-20 17:48 采纳率: 0%
浏览 23

在CSS中创建叠加层?

I have div that I display dynamically when certain conditions arise.

When I display the div, how can I create the effect of the background dimming and my div appearing to be prominent? much like a number of AJAX lightboxes or popups. (Thickbox, ColorBox, PrettyPhoto, etc)

I don;t quite get how they do it. I have everything else working in my own custom code except that piece.

Can anyone help me learn how?

  • 写回答

4条回答 默认 最新

  • weixin_33725722 2010-12-20 17:51
    关注

    Place a div over the content and set an opacity. I use this in one of my sites.

    <div id="error_wrapper">
        <div id="site_error">
            Error:
        </div>
    </div>
    
    div#error_wrapper {
        z-index: 100;
        position: fixed;
        width: 100%;
        height: 100%;
        background-color: #000000;
        top: 0px;
        left: 0px;
        opacity: 0.7;
        filter: alpha(opacity=70);
    
    }
    
    div#site_error {
        position: fixed;
        top: 200px;
        width: 400px;
        left: 50%;
        margin-left: -200px;
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献