当前位置:网站首页>align-items 与 align-content 的区别
align-items 与 align-content 的区别
2022-06-28 12:55:00 【HHppGo】
最明显的区别是align-content 适用于多行,align-item 则是适用于单行。
align-content(单行无效)可以设置上对齐、下对齐、居中、拉伸、平分剩余空间;align-item上对齐、下对齐、居中、拉伸。
1. align-items
定义和属性:
align-items属性定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。提示:使用每个弹性对象元素的 align-self 属性可重写 align-items 属性。
属性值:
stretch :
默认值。如果指定侧轴大小的属性值为’auto’,则其值会使项目的边距盒的尺寸尽可能接近所在行的尺寸,但同时会遵照’min/max-width/height’属性的限制。
center:
位于容器的中心。弹性盒子元素在该行的侧轴(纵轴)上居中放置。(如果该行的尺寸小于弹性盒子元素的尺寸,则会向两个方向溢出相同的长度)。
flex-start :
位于容器的开头。弹性盒子元素的侧轴(纵轴)起始位置的边界紧靠住该行的侧轴起始边界。
flex-end:
位于容器的结尾。弹性盒子元素的侧轴(纵轴)起始位置的边界紧靠住该行的侧轴结束边界。
baseline:
位于容器的基线上。如弹性盒子元素的行内轴与侧轴为同一条,则该值与’flex-start’等效。其它情况下,该值将参与基线对齐。
initial:
该属性为它的默认值。
inherit:
从父元素继承该属性。
2. align-content 属性
定义和用法
align-content属性修改flex-wrap属性的行为。它与align-items
相似,但是它不对齐弹性项目,而是对齐弹性线。*注意:必须有多行项目,此属性才能生效!
*提示:使用 justify-content 属性可将主轴上的项目(main-axis)水平对齐。
属性值:
stretch
默认值。行拉伸以占据剩余空间。
center
朝着弹性容器的中央对行打包。
flex-start
朝着弹性容器的开头对行打包。
flex-end
朝着弹性容器的结尾对行打包。
space-between
行均匀分布在弹性容器中。
space-around
行均匀分布在弹性容器中,两端各占一半。
initial
将此属性设置为其默认值。
inherit
从其父元素继承此属性。
边栏推荐
- 从pdb源码到frame帧对象
- ASP.NET CORE Study02
- 命名空间和作用域
- 基础软件照搬开源不可取,自力更生才是正途
- Can ArcGIS Pro directly connect PostgreSQL and edit layer elements
- 一款自动生成单元测试的 IDEA 插件,开发效率提升 70% 以上!
- SHAREit实力出众,登陆全球 IAP 实力榜 Top7
- Manjaro easyconnecy error: libgtk-x11-2.0 so. 0: cannot open shared object file: No such file or directory
- Après avoir échoué à l'examen d'entrée à l'Université de technologie de Harbin, vous devez rester à l'Université en tant que « chercheur » après avoir obtenu votre diplôme.
- 如何在Microsoft Exchange 2010中安装SSL证书
猜你喜欢

ASP.NET CORE Study04

ASP.NET CORE Study05

From simplekv to redis
JS class is not just a simple syntax sugar!

【历史上的今天】6 月 28 日:马斯克诞生;微软推出 Office 365;蔡氏电路的发明者出生

Unity releases webgl and wakes up keyboard input on the mobile terminal inputfield

Bytev builds a dynamic digital twin network security platform -- helping network security development

Hundreds of lines of code to implement a JSON parser

ASP.NET CORE Study08

基础软件照搬开源不可取,自力更生才是正途
随机推荐
Beginner level of attack and defense World Hello_ pwn
数启扬帆,智聚人才 | 腾讯云数据库 & CSDN 工程师能力轻量认证发布会重磅来袭!...
微服务稳定性保障
Jerry's wif interferes with Bluetooth [chapter]
Namespace and scope
Enterprise source code confidentiality scheme sharing
ASP.NET CORE Study06
I ² C. SMBus, pmbus relationships
Microservice stability guarantee
Digital twin energy system, creating a "perspective" in the low-carbon era
关于IP定位查询接口的测评Ⅰ
BUUCTF:[WUSTCTF2020]朴实无华
腾讯确认QQ大规模盗号,iPhone14无缘Type-C,第四大运营商5G正式放号,今日更多大新闻在此...
The Research Report of Analysys' 2022 China Banking privacy computing platform supplier strength matrix analysis' was officially launched
newest! Introduction and practical tutorial of point cloud processing based on open3d
Which securities company is the best and safest? How to open an account is the safest
My NVIDIA developer tour -jetson nano 2GB teaches you how to train models (complete model training routines)
From simplekv to redis
Mathematical principle derivation of structured light phase shift method + multifrequency heterodyne
JS duration and asynchronous function promise