CSS - div居中在屏幕中(水平居中 + 垂直居中)
2024-09-04 03:59:09
方法一代码
<div>
<h1>404 Not Found.</h1>
</div>
<style>
div {
text-align: center;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
</style>
在新Tab打开
方法二代码
.vertical-container {
height: 300px;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
最新文章
- Moqui学习Day3
- ios 常用的小框架
- 【BZOJ】【1391】【CEOI2008】order
- Genymotion 模拟器 VirtualBox
- css 梯形标签页
- boost锁的概述
- IOS打包相关问题
- Spring mybatis源码篇章-XMLLanguageDriver解析sql包装为SqlSource
- 运行selenium脚本,报seleneium common exception.SessionNotCreatedException:Message:Unable to find a matching set of capabilities错误
- leetcode — merge-sorted-array
- Git与SVN交叉使用
- 分布式架构探索 - 1. RPC框架之Java原生RMI
- C语言变量声明内存分配
- (转)关于CNN中平移不变性的理解
- 使用Tortoise结合Git比较两个版本的差异
- vue中npm run dev运行项目不能自动打开浏览器! 以及 webstorm跑vue项目jshint一直提示错误问题的解决方法!
- Linux学习笔记02—磁盘分区
- eclipse library jar包 使用总结 MD
- Tensorflow 初级教程(一)
- Linux 下tomcat的配置
热门文章
- PHP程序员应该如何提升
- 测试准确率计算方法说明 pre.eq(target).float().sum().item()
- (转)数据索引BTree
- MongoDB - String转换为Int,并更新到数据库中
- Failed to start mysqld.service: Unit not found
- HTML的网页基本结构
- awk从放弃到入门(1):awk基础
- 【Python】数值运算函数
- mongo shell远程连接使用数据库
- @RequestMapping(value = {";list";, ";";})