Flexible 弹性盒子模型之CSS align-self 属性

高洛峰
Release: 2017-02-23 09:55:39
Original
1750 people have browsed it


实例

居中对齐弹性对象元素内的某个项:

  1. #myBluep

  2. {

  3. align-self:center;

  4. }





手册网(www.shouce.ren)




  
红色
  
蓝色
     
带有更多内容的绿色 div

注意: align-self 属性重写了容器的 align-items 属性。

注意: Internet Explorer 10 及更早版本浏览器不支持 align-items 属性。

注意: Safari 7.0 及更新版本通过 -webkit-align-items 属性支持该属性。

Copy after login

效果预览


浏览器支持

表格中的数字表示支持该属性的第一个浏览器的版本号。

紧跟在 -webkit-, -ms- 或 -moz- 后的数字为支持该前缀属性的第一个版本。

属性     
align-self21.011.020.09.0
7.0 -webkit-
12.1

定义和用法

align-self 属性定义flex子项单独在侧轴(纵轴)方向上的对齐方式。。

注意:align-self 属性可重写灵活容器的 align-items 属性。

默认值:auto
继承:
可动画化:否。请参阅 CSS3动画属性、CSS3动画实例
版本:CSS3
JavaScript 语法:object.style.alignSelf="center" 效果预览

 


CSS 语法


align-self: auto|stretch|center|flex-start|flex-end|baseline|initial|inherit;

属性值

描述测试
auto默认值。元素继承了它的父容器的 align-items 属性。如果没有父容器则为 "stretch"。效果预览
stretch元素被拉伸以适应容器。效果预览
center元素位于容器的中心。效果预览
flex-start元素位于容器的开头。效果预览
flex-end元素位于容器的结尾。效果预览
baseline元素位于容器的基线上。效果预览
initial设置该属性为它的默认值。请参阅 initial。效果预览
inherit从父元素继承该属性。请参阅 inherit。
更多Flexible 弹性盒子模型之CSS align-self 属性相关文章请关注PHP中文网!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!