CSS效果——绝对居中
2024-09-05 12:48:53
实现效果
不论窗口尺寸,都可以垂直和水平居中。
代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>居中效果</title>
<link href="style.css" rel="stylesheet">
<style type="text/css">
.warp {
width:0;
height:0;
position:fixed;
left:50%;
right:50%;
top:50%;
bottom:50%;
} .loginPanel {
width:500px;
height:400px;
margin-left:-250px;
margin-top:-200px;
background-color:#499ECA;
} </style>
</head>
<body>
<div class="warp">
<div class="loginPanel"> </div>
</div>
</body>
</html>
最新文章
- C#中5步完成word文档打印的方法
- 【踩坑速记】开源日历控件,顺便全面解析开源库打包发布到Bintray/Jcenter全过程(新),让开源更简单~
- pythonchallenge 解谜 Level 1
- python中try except执行顺序
- webpack-vue搭建,部署到后端
- 11. 星际争霸之php设计模式--备忘模式
- 2016 - 1- 22 NSURLConnetction --- POST请求
- 用来用去还是觉得SDCMS好用
- javaweb学习总结五(内省、beanUtils工具包)
- timed out waiting for input: auto-logout
- DEVC++生成DLL的方法
- Microsoft Deployment Toolkit 2013 Preview Release Now Available
- Codeforces 437E The Child and Polygon(间隔DP)
- oracle 索引 。其中全文检索最变态
- iPhone safari中Document事件不触发的解决方案 [冒泡]
- 链表回文判断(C++)
- 使用Swiper轮播插件引起的探索
- keil5一点project就闪退
- 各种容器与服务器的区别与联系:Servlet容器、WEB容器、Java EE容器、应用服务器、WEB服务器、Java EE服务器
- 项目总结19:layui实现表格渲染、表格搜索、数据获取