当前位置:网站首页>水平垂直居中方式
水平垂直居中方式
2022-08-02 12:33:00 【sdKdqweas】
第一种是flex布局
flex布局,flex布局首先要把原来的元素的样式给他转换过来,所有的元素都变成了flex的容器(item或项目)。项目默认是按照主轴排列的(这个也可以设置的),每个容器的大小也是可以设置的,这个是比较特殊的使用方式
flex-basis,flex-shrink,flex-grow。
这个适用于与在一条主轴上的布局方式(justify-content
)
align-item(设置在交叉轴的布局方式),交叉轴的布局方式可以设置在垂直方向的布局效果。
2.定位方式
绝对定位+transform(支持翻转,缩小,平移):绝对定位脱离文档流,但是增加了top,left这类可以可以进行用于移动的属性。适合登录页的设定
绝对定位+已知宽高的硬移动
3.特殊的margin:0 auto;
由浏览器去帮我们分配左右的空间,适合单个盒子的居中
4.text-align vertical-align
text-align设置一个块元素的行内元素的对齐方式。vertical-align设置块元素的行内元素的对齐方式
边栏推荐
- Intelligent Image Analysis-Intelligent Home Appliance Image Target Detection Statistical Counting Detection and Recognition-iCREDIT
- FreeRTOS--优先级实验
- TFRecord简介,原理分析,代码实现?[通俗易懂]
- 测试开发之路,我在大厂做测试这四年的感悟
- Drools(8):WorkBench使用
- Custom mvc framework review
- simulink PID自动整定
- SQL Server 2014安装教程(保姆级图解教程)
- FreeRTOS creation tasks - dynamic creation, static creation
- String concatenation in SQL
猜你喜欢
随机推荐
FreeRTOS创建任务--动态创建、静态创建
1.3快速生成树协议RSTP
Thymeleaf
According to the field classification Golang map array
pig4cloud服务架构使用
LeetCode_139_单词拆分
Likou 58 - Left Rotation String
photo-sphere-viewer中文文档
30 lines of code to realize serverless real-time health code recognition -- operation manual
Technology sharing | Description of the electronic fence function in the integrated dispatching system
kvm部署
一款强大的js弹出alert插件
js炫酷仪表盘插件
Data Lake (2): What is Hudi
如何搭建威纶通触摸屏与S7-200smart之间无线PPI通信?
zabbix自动化监控脚本
FreeRTOS--栈实验
OpenFeign设置header的3种方式
Openlayers Quick Start Tutorial
测试开发之路,我在大厂做测试这四年的感悟