当前位置:网站首页>Two ways to center block level elements
Two ways to center block level elements
2022-06-25 23:45:00 【Delusion_ wangx】
1、 Without setting absolute positioning , After setting the width of the block level element, use margin:0 auto; In the middle
2、 Set to absolute positioning , Adjust the distance from the left margin to the center according to the width ,
example :
position: absolute;
left: 25%;
width: 50%;
or
position: absolute;
left: 50%;
margin-left: -50px;
width: 100px;
There is no problem in centering these two methods , But with absolute positioning , Reuse margin:0 auto Nine cannot be centered . The specific reason is unknown , I checked several articles , It is said that this is the rule , Just use it . Later, due to limited time, I didn't go deep into it . If you know the reason, please leave a message in the comment area , Thank you for the first ,
边栏推荐
- 两种块级元素居中的方式
- 实例:用C#.NET手把手教你做微信公众号开发(21)--使用微信支付线上收款:H5方式
- Screen recording to GIF is an easy-to-use gadget, screentogif, which is free and easy to use!
- util. Collection and encapsulation of JS tool functions
- Leetcode-1528- rearrange string - hash table - string
- 发送邮件工具类
- Hibernate architecture introduction and environment construction (very detailed)
- Qtcreator formatting code
- IDEA中如何生成get/set方法
- 4个要点,助力产品管好项目
猜你喜欢

实例:用C#.NET手把手教你做微信公众号开发(21)--使用微信支付线上收款:H5方式

第六章 习题(678)【微机原理】【习题】

解析产品开发失败的5个根本原因

YUV444、YUV422、YUV420、YUV420P、YUV420SP、YV12、YU12、NV12、NV21

Architecture part -- the use of UMI framework and DVA

Uni app -- listen for the exit of the return key

Hbuilderx uses the gaude map to obtain the current location

CSDN添加页内跳转和页外指定段落跳转

CXF

期末复习【机器学习】
随机推荐
php socket通信中stream_select方法的理解
mongodb
excel如何实现中文单词自动翻译成英文?这个公式教你了
Px4 multi computer simulation (gazebo)
18亿像素火星全景超高清NASA放出,非常震撼
Tree class query component
BI-SQL丨存储过程(一)
平衡二叉树AVL
Classic image segmentation network: UNET supports libtorch deployment reasoning [with code]
先序线索二叉树
Online customer service - charging standards and service provision of third parties
CSDN add on page Jump and off page specified paragraph jump
Hibernate architecture introduction and environment construction (very detailed)
Informatics Orsay all in one 1353: expression bracket matching | Luogu p1739 expression bracket matching
php中使用google protobuf协议环境配置
mysql5.7版本在配置文件my.ini[mysqld]加上skip-grant-tables后无法启动
4个要点,助力产品管好项目
php性能优化
IDEA中如何生成get/set方法
DPVS-FullNAT模式部署篇