当前位置:网站首页>绝对定位时元素水平垂直居中
绝对定位时元素水平垂直居中
2022-07-03 17:06:00 【The pure land】
假设元素长宽均为100px,使其水平垂直居中有两种方法
1.
.item{
position:absolute;
left:50%;
top:50%;
margin-left:-50px;/*100px的一半*/
margin-top:-50px;/*100px的一半*/
}
2.
.item{
position:absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin:auto;
}
边栏推荐
- 美团一面:为什么线程崩溃崩溃不会导致 JVM 崩溃
- CC2530 common registers for port initialization
- Apache service suspended asynchronous acceptex failed
- [combinatorics] recursive equation (outline of recursive equation content | definition of recursive equation | example description of recursive equation | Fibonacci Series)
- 关于学习Qt编程的好书精品推荐
- 大消费企业怎样做数字化转型?
- [combinatorics] recursive equation (the relationship theorem between the solution of the recursive equation and the characteristic root | the linear property theorem of the solution of the recursive e
- On Lagrange interpolation and its application
- Summary of three methods of PHP looping through arrays list (), each (), and while
- Free data | new library online | cnopendata complete data of China's insurance intermediary outlets
猜你喜欢

跨境电商:外贸企业做海外社媒营销的优势

Meituan side: why does thread crash not cause JVM crash

CC2530 common registers for port initialization

2022.02.14_ Daily question leetcode five hundred and forty

Prepare for the golden three silver four, 100+ software test interview questions (function / interface / Automation) interview questions. win victory the moment one raises one 's standard

美团一面:为什么线程崩溃崩溃不会导致 JVM 崩溃

Build your own website (23)
智慧之道(知行合一)

PHP online confusion encryption tutorial sharing + basically no solution

Talk about several methods of interface optimization
随机推荐
vs code 插件 koroFileHeader
Kotlin learning quick start (7) -- wonderful use of expansion
Redis:关于列表List类型数据的操作命令
One brush 148 force deduction hot question-5 longest palindrome substring (m)
What material is sa537cl1? Sa537cl1 corresponds to the national standard material
[2. Basics of Delphi grammar] 1 Identifiers and reserved words
The most complete postman interface test tutorial in the whole network, API interface test
Why is WPA3 security of enterprise business so important?
[2. Basics of Delphi grammar] 2 Object Pascal data type
Great changes! National housing prices fell below the 10000 yuan mark
Analysis of variance summary
How to allow remote connection to MySQL server on Linux system?
Apache service suspended asynchronous acceptex failed
PHP converts a one-dimensional array into a two-dimensional array
Fast Ethernet and Gigabit Ethernet: what's the difference?
What is the material of sa302grc? American standard container plate sa302grc chemical composition
One brush 146 force buckle hot question-3 longest substring without repeated characters (m)
utfwry. Dat PHP, about ThinkPHP's method of IP location using utfwry address Library
Squid service startup script
13mnnimo5-4 German standard steel plate 13MnNiMo54 boiler steel 13MnNiMo54 chemical properties