当前位置:网站首页>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
从其父元素继承此属性。
边栏推荐
- group_concat学习与配置
- ASP.NET CORE Study04
- Xiaobai's e-commerce business is very important to choose the right mall system!
- 哪一个证券公司最好最安全 怎么办理开户最安全
- pytorch模型调参、训练相关内容
- The paging style flex is set to be displayed at the end (even if the number of pages is longer, there will be no line breaks at the end)
- Jerry's wif interferes with Bluetooth [chapter]
- 电脑无线网络不显示网络列表应该如何解决
- Unity WebGL移动端去除警告
- Jerry's wif interferes with Bluetooth [chapter]
猜你喜欢

I ² C. SMBus, pmbus relationships
![[today in history] June 28: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born](/img/bf/09ccf36caec099098a22f0e8b670bd.png)
[today in history] June 28: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born

newest! Introduction and practical tutorial of point cloud processing based on open3d

Realization of a springboard machine

Fastposter v2.8.4 release e-commerce poster generator

From simplekv to redis

几百行代码实现一个 JSON 解析器

The Research Report of Analysys' 2022 China Banking privacy computing platform supplier strength matrix analysis' was officially launched

高考失利進哈工大,畢業卻留校要當“探索者”,丁效:科研就是厚積薄發

From jsonpath and XPath to spl
随机推荐
Performance test-01-introduction
数启扬帆,智聚人才 | 腾讯云数据库 & CSDN 工程师能力轻量认证发布会重磅来袭!...
pytorch模型调参、训练相关内容
ASP. NET CORE Study11
Login interface accesses and clears the token
Evaluation of IP location query interface I
ASP.NET CORE Study04
Jerry's wif interferes with Bluetooth [chapter]
Ipetronik data acquisition equipment and softing q-vision software are committed to ADAS test scheme
##测试bug常用“Redmine”
ASP.NET CORE Study03
Fastposter v2.8.4 release e-commerce poster generator
ASP.NET CORE Study05
My NVIDIA developer tour -jetson nano 2GB teaches you how to train models (complete model training routines)
fastposter v2.8.4 发布 电商海报生成器
MySQ 8.0 推出直方图,性能大大提升!
Jerry's wif interferes with Bluetooth [chapter]
An idea plug-in that automatically generates unit tests, which improves the development efficiency by more than 70%!
为什么CAD导出PDF没有颜色
思源官方付费同步使用指南