当前位置:网站首页>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;
}
边栏推荐
- BYD and great wall hybrid market "get together" again
- 网络安全web渗透技术
- Meituan side: why does thread crash not cause JVM crash
- MySQL user management
- Host based intrusion system IDS
- Visual studio "usually, each socket address (Protocol / network address / port) can only be used once“
- Leetcode: lucky number in matrix
- Execute script unrecognized \r
- 【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
- One brush 149 force deduction hot question-10 regular expression matching (H)
猜你喜欢
Atom QT 16_ audiorecorder
【RT-Thread】nxp rt10xx 设备驱动框架之--Audio搭建和使用
Mysql database -dql
Bcvp developer community 2022 exclusive peripheral first bullet
ucore概述
Kotlin学习快速入门(7)——扩展的妙用
2021 ICPC regional competition (Shanghai) g.edge groups (tree DP)
New features of C 10
Life is still confused? Maybe these subscription numbers have the answers you need!
29: Chapter 3: develop Passport Service: 12: develop [obtain user account information, interface]; (use VO class to package the found data to meet the requirements of the interface for the returned da
随机推荐
線程池:業務代碼最常用也最容易犯錯的組件
Kotlin学习快速入门(7)——扩展的妙用
大变局!全国房价,跌破万元大关
Great changes! National housing prices fell below the 10000 yuan mark
【RT-Thread】nxp rt10xx 设备驱动框架之--hwtimer搭建和使用
CC2530 common registers for watchdog
One brush 149 force deduction hot question-10 regular expression matching (H)
定义一个结构体Fraction,表示分数,用于表示 2/3, 5/6这样的分数
[combinatorial mathematics] recursive equation (example of recursive equation 2 Hanoi Tower | example of recursive equation 3 insertion sequencing)
Unity notes unityxr simple to use
美团一面:为什么线程崩溃崩溃不会导致 JVM 崩溃
Leetcode: lucky number in matrix
Execute script unrecognized \r
[2. Basics of Delphi grammar] 2 Object Pascal data type
How to allow remote connection to MySQL server on Linux system?
Web crawler knowledge day03
Fast Ethernet and Gigabit Ethernet: what's the difference?
比亚迪、长城混动市场再“聚首”
visual studio “通常每个套接字地址(协议/网络地址/端口)只允许使用一次“
Answer to the homework assessment of advanced English reading (II) of the course examination of Fuzhou Normal University in February 2022