使用CSS Modal HTML结构
<ul><li><a href="#modal-show" title="CSS Modal">CSS Modal</a></li></ul><section class="modal--show" id="modal-show" tabindex="-1" role="dialog" aria-labelledby="label-show" aria-hidden="true"><div class="modal-inner">
<header>
<h2 id="label-show">CSS Modal—纯CSS实现模态窗口</h2>
</header>
<div class="modal-content">
<p>今天介绍一个用CSS实现模态窗口的插件——CSS Modal ,利用它可以很方便的实现模态窗口。它可以用来展示任意的HTML内容,并且支持响应式设计,具有良好的兼容性,通过它的js扩展,还能实现更强大的功能。</p>
</div>
<footer>
<p>by ZJIAN</p>
</footer>
</div>
<a href="#!" class="modal-close" title="Close this modal" data-dismiss="modal" data-close="Close">&times</a></section>
这是它最基本的使用方法,点击ul标签中的CSS Modal就会弹出section标签中的内容,如果你想使用更高级的功能,比如相册的展示、视频等等功能,CSS Modal也提供了解决方案,需要引入plugins中对应的js文件。
工具:电脑;浏览器;ultraedit软件;
操作步骤如下:
1、打开UE编辑器,新建一个空白的html文件和css文件;
2、在html文件中输入以下html代码;
3、在css文件中输入以下css代码;
4、编辑完成之后,选择格式为UTF8-无 BOM模式,保存文件;
5、在浏览器中打开此html文件,可以看到最终想要实现的遮住全屏效果。