::綠細胞雜誌::

Would you like to react to this message? Create an account in a few clicks or log in to continue.

紀錄生活一切雜事


    :::純CSS Lightbox效果 (無需JS):::

    grass0423
    grass0423
    Admin


    文章數 : 122
    注冊日期 : 2010-02-23

    :::純CSS Lightbox效果 (無需JS)::: Empty :::純CSS Lightbox效果 (無需JS):::

    發表  grass0423 周五 1月 28, 2011 3:19 pm

    :::純CSS Lightbox效果 (無需JS)::: Aoc_410
    css
    代碼:

    <style>
    body{font-size:11px; font-family:Verdana, Arial, Helvetica, sans-serif;}
    a{color:#000; text-decoration:none;}
    .img{border:0px;}
    .black_overlay{
      display: none;
      position: absolute;
      top: 0%;
      left: 0%;
      width: 100%;
      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: 15%;
      left: 25%;
      width: 632px;
      height: 445px;
      border: 16px solid #FFF;
      border-bottom:none;
      background-color: white;
      z-index:1002;
      overflow: auto;
    }
    </style>

    HTML部分:
    代碼:
    <body>
    <p>This is the main content. To display a lightbox click <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">here</a></p>
    <div id="light" class="white_content">This is the lightbox content. <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a></div>
    <div id="fade" class="black_overlay"></div>
    </body>

      現在的時間是 周四 9月 19, 2024 10:45 am