当前位置:网站首页>水平垂直居中方式
水平垂直居中方式
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设置块元素的行内元素的对齐方式
边栏推荐
- 数据湖(一):数据湖概念
- Openlayers Quick Start Tutorial
- 主流跨端技术一览
- Drools(8):WorkBench使用
- Software component analysis: 5 major capabilities to protect software supply chain security
- svg气球升起爆炸js特效
- 自己如何做小程序呢?
- Openlayers 快速上手教程
- DTG-SSOD: The latest semi-supervised detection framework, Dense Teacher (with paper download)
- After Effects 教程,如何在 After Effects 中对蒙版进行动画绘制?
猜你喜欢

simulink PID auto-tuning

A powerful js pop-up alert plugin

Import and export data of SQL Server database

Drools(8):WorkBench使用

js stopwatch countdown plugin

Process finished with exit code 1

How to better assess credit risk?Just watch this scorecard model live

FreeRTOS实验--一个函数创建多个任务

To eliminate air bubbles to save the mushroom h5 small game source code

js真3d柱状图插件
随机推荐
SQL Server 2019安装错误0x80004005 服务没有及时响应启动或控制请求详细解决方法
Lexicon 27 - Remove Elements - Simple Questions
FreeRTOS--Priority Experiment
数据湖(二):什么是Hudi
pig4cloud服务架构使用
Likou 704 - binary search
SQL Server 数据库之生成与执行 SQL 脚本
svg气球升起爆炸js特效
Taurus.MVC V3.0.3 微服务开源框架发布:让.NET 架构在大并发的演进过程更简单。
WPF——自定义日历
Object.entries()
ssm访问数据库数据报错
网络流详解(流网图一般能够反映什么信息)
FreeRTOS--优先级实验
机器人碰撞检测方法形式化
Four seasons of trees realized by svg
Pod Scheduling Strategy: Affinity, Stain and Stain Tolerance
sql concat()函数
Distributed current limiting, hand & redisson implementation
svg balloon rises explosion js special effect