HTML / CSS弹出文本点击div [英] HTML / CSS Popup div on text click

查看:134
本文介绍了HTML / CSS弹出文本点击div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的关于图片/页面使用当前按钮弹出窗口,而不是弹出窗口,如下例所示:

解决方案

DEMO / p>

在内容区域中,您可以提供要显示的任何内容。



  .black_overlay {display:none; position:absolute; top:0%; left:0%;宽度:100%;高度:100%;背景颜色:黑色; z指数:1001; -moz-不透明度:0.8;不透明度:.80; filter:alpha(opacity = 80);}。white_content {display:none; position:absolute; top:25%;左:25%; width:50%;身高:50% padding:16px; border:16px solid orange; background-color:white; z指数:1002; overflow:auto;}  

 < html>< head> ; < title> LIGHTBOX EXAMPLE< / title>< / head>< body> < p>这是主要内容。要显示灯箱,请点击< a href =javascript:void(0)onclick =document.getElementById('light')。style.display ='block'; document.getElementById('fade')。style.display ='block'>这里< / a> < / p> < div id =lightclass =white_content>这是灯箱内容。 < a href =javascript:void(0)onclick =document.getElementById('light')。style.display ='none'; document.getElementById('fade')。style.display ='none' >关闭< / a> < / div> < div id =fadeclass =black_overlay>< / div>< / body>< / html>  

div>


I want to make popup div instead of popup window for my 'About' picture/page with current button like in this example:

解决方案

DEMO

In the content area you can provide whatever you want to display in it.

.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: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  padding: 16px;
  border: 16px solid orange;
  background-color: white;
  z-index: 1002;
  overflow: auto;
}

<html>

<head>
  <title>LIGHTBOX EXAMPLE</title>
</head>

<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>

</html>

这篇关于HTML / CSS弹出文本点击div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆