当前位置:网站首页>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
从其父元素继承此属性。
边栏推荐
- flutter 系列之:flutter 中常用的 GridView layout 详解
- 哪一个证券公司最好最安全 怎么办理开户最安全
- After failing in the college entrance examination, he entered Harbin Institute of technology, but stayed in the university after graduation to be an "Explorer". Ding Xiao: scientific research is accum
- ASP. NET CORE Study02
- 电脑无线网络不显示网络列表应该如何解决
- 基于SSM实现水果蔬菜商城管理系统
- 几百行代码实现一个 JSON 解析器
- ASP.NET CORE Study02
- UDP RTP packet frame loss
- Tencent has confirmed that QQ has stolen numbers on a large scale, iphone14 has no chance of type-C, and 5g, the fourth largest operator, has officially released numbers. Today, more big news is here
猜你喜欢

一文抄 10 篇!韩国发表的顶级会议论文被曝抄袭,第一作者是“原罪”?

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

Implementation of fruit and vegetable mall management system based on SSM

ASP.NET CORE Study09

My NVIDIA developer tour -jetson nano 2GB teaches you how to train models (complete model training routines)

10万美元AI竞赛:寻找大模型做得“更烂”的任务

基于SSM实现水果蔬菜商城管理系统

I²C、SMBus、PMBus关系

【云原生】自助报表和BI能做这么多事?

Namespace and scope
随机推荐
In fact, there are a lot of MATLAB learning and use materials (many documents and videos) on the official website of MATLAB
Mathematical principle derivation of structured light phase shift method + multifrequency heterodyne
k3s一键安装脚本
Jerry's wif interferes with Bluetooth [chapter]
华泰证券手机app下载 怎么办理开户最安全
.NET混合开发解决方案24 WebView2对比CefSharp的超强优势
Continuous integration practice of Baidu app based on pipeline as code
pytorch基础
ASP.NET CORE Study08
VS2012 VC新建一个空白窗口应用
BUUCTF:[WUSTCTF2020]朴实无华
$100000 AI competition: the task of finding "worse" big models
电脑无线网络不显示网络列表应该如何解决
ASP.NET CORE Study05
腾讯确认QQ大规模盗号,iPhone14无缘Type-C,第四大运营商5G正式放号,今日更多大新闻在此...
微服务稳定性保障
Here comes Wi Fi 7. How strong is it?
ASP. NET CORE Study03
腾讯汤道生:面向数实融合新世界,开发者是最重要的“建筑师”
Jerry's wif interferes with Bluetooth [chapter]