当前位置:网站首页>When absolutely positioned, the element is horizontally and vertically centered
When absolutely positioned, the element is horizontally and vertically centered
2022-07-03 17:11:00 【The pure land】
Assume that the length and width of the elements are 100px, There are two ways to center it horizontally and vertically
1.
.item{
position:absolute;
left:50%;
top:50%;
margin-left:-50px;/*100px Half of */
margin-top:-50px;/*100px Half of */
}
2.
.item{
position:absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin:auto;
}
边栏推荐
- C语言字符串反转
- Open vsftpd port under iptables firewall
- 【RT-Thread】nxp rt10xx 设备驱动框架之--Pin搭建和使用
- Thread pool: the most common and error prone component of business code
- Unity notes unityxr simple to use
- C language string practice
- Kotlin学习快速入门(7)——扩展的妙用
- Web crawler knowledge day03
- Leetcode: lucky number in matrix
- The largest matrix (H) in a brush 143 monotone stack 84 histogram
猜你喜欢
Meituan side: why does thread crash not cause JVM crash
Redis:关于列表List类型数据的操作命令
New features of C 10
Web crawler knowledge day03
Fast Ethernet and Gigabit Ethernet: what's the difference?
kubernetes资源对象介绍及常用命令(三)
Analysis of variance summary
图之深度优先搜索
Bcvp developer community 2022 exclusive peripheral first bullet
C语言按行修改文件
随机推荐
【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
vs code 插件 koroFileHeader
[combinatorics] recursive equation (constant coefficient linear homogeneous recursive equation | constant coefficient, linear, homogeneous concept description | constant coefficient linear homogeneous
IL Runtime
Squid 服务启动脚本
One brush 142 monotone stack next larger element II (m)
Examination questions for the assignment of selected readings of British and American Literature in the course examination of Fujian Normal University in February 2022
执行脚本不认\r
The largest matrix (H) in a brush 143 monotone stack 84 histogram
深入理解 SQL 中的 Grouping Sets 语句
MySQL Basics
CC2530 common registers
Answer to the homework assessment of advanced English reading (II) of the course examination of Fuzhou Normal University in February 2022
Free data | new library online | cnopendata complete data of China's insurance intermediary outlets
Bcvp developer community 2022 exclusive peripheral first bullet
Deep understanding of grouping sets statements in SQL
kubernetes资源对象介绍及常用命令(五)-(NFS&PV&PVC)
[combinatorics] recursive equation (example of solving recursive equation without multiple roots | complete process of solving recursive equation without multiple roots)
CC2530 common registers for ADC single channel conversion
C language string inversion