Home > Web Front-end > HTML Tutorial > css实现的弹出窗口始终垂直水平居中效果_html/css_WEB-ITnose

css实现的弹出窗口始终垂直水平居中效果_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:28:33
Original
921 people have browsed it

css实现的弹出窗口始终垂直水平居中效果:
本章节介绍一下如何实现一个弹出窗口实现垂直水平居中效果,无论是否拖动滚动条。
代码实例:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">body{  height:1000px;}.antzoen{  position:fixed;  width:250px;  height:100px;  background:#ececec;  left:50%;  top:50%;  margin-left:-125px;  margin-top:-50px}</style></head><body><div class="antzoen"></div></body></html>
Copy after login

上面的代码实现了我们的要求,可以实现始终垂直水平居中的效果。
fixed在IE6中不支持,但是现在还用考虑IE6吗。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=15473

更多内容可以参阅:http://www.softwhy.com/divcss/

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template