当前位置:网站首页>绝对定位时元素水平垂直居中
绝对定位时元素水平垂直居中
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;
}
边栏推荐
- [try to hack] active detection and concealment technology
- 数据分析必备的能力
- On Lagrange interpolation and its application
- One brush 142 monotone stack next larger element II (m)
- Shentong express expects an annual loss of nearly 1billion
- 27. Input 3 integers and output them in descending order. Pointer method is required.
- CC2530 common registers for watchdog
- [combinatorics] recursive equation (definition of general solution | structure theorem of general solution of recursive equation without multiple roots)
- Redis: operation commands for list type data
- Daily code 300 lines learning notes day 10
猜你喜欢
随机推荐
數據分析必備的能力
[combinatorial mathematics] counting model, common combinatorial numbers and combinatorial identities**
Host based intrusion system IDS
ucore概述
How do large consumer enterprises make digital transformation?
JSON 与 BSON 区别
深入理解 SQL 中的 Grouping Sets 语句
CC2530 common registers
29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)
线程池:业务代码最常用也最容易犯错的组件
One brush 142 monotone stack next larger element II (m)
执行脚本不认\r
CC2530 common registers for serial communication
Daily code 300 lines learning notes day 10
What is the material of 13mnnimor? 13mnnimor steel plate for medium and low temperature pressure vessels
Build your own website (23)
What is the difference between 14Cr1MoR container plate and 14Cr1MoR (H)? Chemical composition and performance analysis of 14Cr1MoR
Life is still confused? Maybe these subscription numbers have the answers you need!
人生还在迷茫?也许这些订阅号里有你需要的答案!
vs code 插件 koroFileHeader