div标签怎么隐藏显示

2020-11-06 综合百科 1万阅读 投稿:yangang

div标签隐藏显示方法:打开html开发软件,新建一个html文件,在html文件上创建一个button按钮,然后给这个按钮设置一个id,在案例中把按钮的id设置为show。

然后创建一个隐藏的div,把需要隐藏的内容写到这个div上,然后给这个div设置一个id,在案例中设置案例的id为hide。给div设置隐藏的样式。在标签后面为id为hide设置样式display:none,这个样id为hide的div就会被隐藏掉了。</p><p>写一段JS代码,来改变div的display属性为'none',要显示就为空,比较简单的实现.style.display就是控制层隐藏或显示的属性.</p><p>DIV是层叠样式表中的定位技术,全称DIVision,即为划分。有时可以称其为图层。DIV在编程中又叫做整除,即只得商的整数。DIV元素是用来为HTML(标准通用标记语言下的一个应用)文档内大块(block-level)的内容提供结构和背景的元素。</p> </div> <div class="tags"> </div> <div class="clear"> <div class="shares"><b>声明:业百科所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系 yebaike@foxmail.com</b><div id="share"></div></div> <div class="act"> <a href="JavaScript:makeRequest('/e/public/digg/?classid=22&id=2144004&dotop=1&doajax=1&ajaxarea=diggnum','EchoReturnedText','GET','');" class="zan" title="赞"><i class="iconfont iconzan"></i> <span id="diggnum"><script type="text/javascript" src="/e/public/ViewClick/?classid=22&id=2144004&down=5"></script></span></a> </div> </div> <div class="clear"></div> </div> <nav class="article-nav"> <span class="article-nav-prev">上一篇<br><a href='/22/2144003.html'>佛教中大象代表什么</a></span> <span class="article-nav-next">下一篇<br><a href='/22/'>返回列表</a></span> </nav> <div class="ny-ad"> <script type="text/javascript" src="/skin/default/js/a01.js"></script> <!-- <div style="border:2px dashed #2d3757;text-align:center;font-size:18px;height:60px;line-height:60px;width:866px;">广告位招租</div> --> </div> <div class="like"> <h3 class="title">猜你喜欢</h3> <div class="piclist likep"> <div class="li"> <div class="img"> <a href="/22/1426178.html" title="84消毒液名字的由来" target="_blank"><img src="https://www.yebaike.com/nimg/84消毒液名字的由来.jpg" alt="84消毒液名字的由来"></a> </div> <a href="/22/" class="cat"></i>综合百科</a> <h3><a href="/22/1426178.html" title="84消毒液名字的由来" target="_blank">84消毒液名字的由来</a></h3> <div class="meta"> <span class="time"><i class="iconfont iconshijian"></i> 10-27</span> <span class="views"><i class="iconfont iconchakan"></i> 1万阅读</span> </div> </div> <div class="li"> <div class="img"> <a href="/22/935532.html" title="降雨弹是用什么物质" target="_blank"><img src="https://www.yebaike.com/nimg/降雨弹是用什么物质.jpg" alt="降雨弹是用什么物质"></a> </div> <a href="/22/" class="cat"></i>综合百科</a> <h3><a href="/22/935532.html" title="降雨弹是用什么物质" target="_blank">降雨弹是用什么物质</a></h3> <div class="meta"> <span class="time"><i class="iconfont iconshijian"></i> 09-25</span> <span class="views"><i class="iconfont iconchakan"></i> 1万阅读</span> </div> </div> <div class="li"> <div class="img"> <a href="/22/935530.html" title="三星s9参数配置在哪里看" target="_blank"><img src="https://www.yebaike.com/nimg/三星s9参数配置在哪里看.jpg" alt="三星s9参数配置在哪里看"></a> </div> <a href="/22/" class="cat"></i>综合百科</a> <h3><a href="/22/935530.html" title="三星s9参数配置在哪里看" target="_blank">三星s9参数配置在哪里看</a></h3> <div class="meta"> <span class="time"><i class="iconfont iconshijian"></i> 09-25</span> <span class="views"><i class="iconfont iconchakan"></i> 1万阅读</span> </div> </div> <div class="li"> <div class="img"> <a href="/22/935528.html" title="鸳鸯的诗句" target="_blank"><img src="https://www.yebaike.com/nimg/鸳鸯的诗句.jpg" alt="鸳鸯的诗句"></a> </div> <a href="/22/" class="cat"></i>综合百科</a> <h3><a href="/22/935528.html" title="鸳鸯的诗句" target="_blank">鸳鸯的诗句</a></h3> <div class="meta"> <span class="time"><i class="iconfont iconshijian"></i> 09-25</span> <span class="views"><i class="iconfont iconchakan"></i> 1万阅读</span> </div> </div> <div class="li"> <div class="img"> <a href="/22/935526.html" title="唇膜有什么用" target="_blank"><img src="https://www.yebaike.com/nimg/唇膜有什么用.jpg" alt="唇膜有什么用"></a> </div> <a href="/22/" class="cat"></i>综合百科</a> <h3><a href="/22/935526.html" title="唇膜有什么用" target="_blank">唇膜有什么用</a></h3> <div class="meta"> <span class="time"><i class="iconfont iconshijian"></i> 09-25</span> <span class="views"><i class="iconfont iconchakan"></i> 1万阅读</span> </div> </div> <div class="li"> <div class="img"> <a href="/22/935523.html" title="霞谷光之翼位置地点攻略" target="_blank"><img src="https://www.yebaike.com/nimg/霞谷光之翼位置地点攻略.jpg" alt="霞谷光之翼位置地点攻略"></a> </div> <a href="/22/" class="cat"></i>综合百科</a> <h3><a href="/22/935523.html" title="霞谷光之翼位置地点攻略" target="_blank">霞谷光之翼位置地点攻略</a></h3> <div class="meta"> <span class="time"><i class="iconfont iconshijian"></i> 09-25</span> <span class="views"><i class="iconfont iconchakan"></i> 1万阅读</span> </div> </div> <div class="clear"></div> </div> </div> <div class="ny-ad"> <script type="text/javascript" src="/skin/default/js/a02.js"></script> <!--<div style="border:2px dashed #2d3757;text-align:center;font-size:18px;height:60px;line-height:60px;width:866px;">广告位招租</div>--> </div> </div> <div class="sidebar"> <!-- <div class="ny-ad"> <div style="border:2px dashed #2d3757;text-align:center;font-size:24px;height:200px;line-height:200px;width:296px;">广告位</div> </div> --> <!-- <div class="widget widget-tags"> <h3>热门标签</h3> <div class="items"> </div> </div> --> <div class="widget postlist"> <h3>最新文章</h3> <ul class="hasimg"> <li> <a href="/22/224884.html" title="礼仪带队如何寻找客户" target="" class="img"><img src="https://www.yebaike.com/nimg/礼仪带队如何寻找客户.jpg" alt=""></a> <a href="/22/224884.html" target="">礼仪带队如何寻找客户</a> <p class="meta"> <span><i class="iconfont iconshijian"></i> 06-29</span> <span><i class="iconfont iconchakan"></i> 1万阅读</span> </p> </li> <li> <a href="/22/224882.html" title="礼物是泡泡的手机直播软件" target="" class="img"><img src="https://www.yebaike.com/nimg/礼物是泡泡的手机直播软件.jpg" alt=""></a> <a href="/22/224882.html" target="">礼物是泡泡的手机直播软件</a> <p class="meta"> <span><i class="iconfont iconshijian"></i> 06-29</span> <span><i class="iconfont iconchakan"></i> 1万阅读</span> </p> </li> <li> <a href="/22/224883.html" title="礼仪初次见面异性之间握手" target="" class="img"><img src="https://www.yebaike.com/nimg/礼仪初次见面异性之间握手.jpg" alt=""></a> <a href="/22/224883.html" target="">礼仪初次见面异性之间握手</a> <p class="meta"> <span><i class="iconfont iconshijian"></i> 06-29</span> <span><i class="iconfont iconchakan"></i> 1万阅读</span> </p> </li> <li> <a href="/22/224881.html" title="礼物轻情意重的成语有哪些" target="" class="img"><img src="https://www.yebaike.com/nimg/礼物轻情意重的成语有哪些.jpg" alt=""></a> <a href="/22/224881.html" target="">礼物轻情意重的成语有哪些</a> <p class="meta"> <span><i class="iconfont iconshijian"></i> 06-29</span> <span><i class="iconfont iconchakan"></i> 1万阅读</span> </p> </li> <li> <a href="/22/224879.html" title="礼让成语填空" target="" class="img"><img src="https://www.yebaike.com/nimg/礼让成语填空.jpg" alt=""></a> <a href="/22/224879.html" target="">礼让成语填空</a> <p class="meta"> <span><i class="iconfont iconshijian"></i> 06-29</span> <span><i class="iconfont iconchakan"></i> 1万阅读</span> </p> </li> <li> <a href="/22/224880.html" title="礼物盒怎么用彩带包装" target="" class="img"><img src="https://www.yebaike.com/nimg/礼物盒怎么用彩带包装.jpg" alt=""></a> <a href="/22/224880.html" target="">礼物盒怎么用彩带包装</a> <p class="meta"> <span><i class="iconfont iconshijian"></i> 06-29</span> <span><i class="iconfont iconchakan"></i> 1万阅读</span> </p> </li> </ul> <script type="text/javascript" src="/skin/default/js/a03.js"></script> </div> </div> </div> </section> <footer class="footer"> <div class="container"> <div class="footer-links"> <ul> <li>推荐栏目:</li> <li><a href="/13" target="_blank" title="生活">生活</a></li> <li><a href="/14" target="_blank" title="数码">数码</a></li> <li><a href="/15" target="_blank" title="美食">美食</a></li> <li><a href="/16" target="_blank" title="教育">教育</a></li> <li><a href="/17" target="_blank" title="旅游">旅游</a></li> <li><a href="/18" target="_blank" title="汽车">汽车</a></li> <li><a href="/19" target="_blank" title="时尚">时尚</a></li> <li><a href="/20" target="_blank" title="金融">金融</a></li> <li><a href="/21" target="_blank" title="百科">百科</a></li> <li><a href="https://www.chaxiao2.com" target="_blank" title="茶小二">茶小二</a></li> <li><a href="https://www.kuxiaotu.com" target="_blank" title="酷小兔">酷小兔</a></li> </ul> </div> <p class="copyright">COPYRIGHT 2017 - 2020 <a href="http://www.yebaike.com/" target="_blank">业百科</a>. ALL RIGHTS RESERVED. | <a href="http://www.beian.miit.gov.cn/" target="_blank">渝ICP备18015459号-2</a> | <a href="http://www.beian.gov.cn/" target="_blank">渝公网安备 50023402000378号</a></p> </div> </footer> <div style="display: none"><script src="https://s5.cnzz.com/z_stat.php?id=1275608778&web_id=1275608778" language="JavaScript"></script></div> <a href="javascript:void(0);" class="back-to-top iconfont iconxiangshang cd-is-visible"></a> <script type="text/javascript" src="/skin/default/js/dscm.js"></script> <!--百度统计--> <div style="display: none"> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?44552da5d82971ed9fdfa8220a8ddf8c"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </div> <!--百度推送--> <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> <script src="/e/public/onclick/?enews=donews&classid=22&id=2144004"></script><script type="text/javascript" src="/skin/default/share/jquery.share.min.js"></script> <script type="text/javascript"> $('#share').share({sites: ['qzone', 'qq', 'weibo','wechat']}); var getWindow = $(window); getWindow.scroll(function(){ var scrollHeight = getWindow.scrollTop(); var contentHeight = $(".content").height() - $(".sidebar").height(); console.log(contentHeight) if(scrollHeight>40 && scrollHeight<contentHeight+40){ $(".sidebar").css({ position:"absolute", right:"0px", top:scrollHeight-40+"px" }) }else if(scrollHeight <= 40){ $(".sidebar").css({ position:"absolute", right:"0px", top:"0px" }) } }) </script> <script type="text/javascript" src="/skin/default/js/a04.js"></script> </body> </html>