flex布局---容器内部,align-self属性

<template>
	<view class="father">
		<view class="son one">1</view>
		<view class="dauther two">2</view>
		<view class="son three">3</view>
		<view class="dauther four">4</view>
	</view>
</template>

<script></script>

<style>
	.father{
		display: flex;
		justify-content: space-between;
		
	}
	.son{
		width: 100px;
		height: 100px;
		background-color: #ff5500;
		border-radius: 5px;
	}
	.dauther{
		width: 50px;
		height: 50px;
		background-color: #5500ff;
		border-radius: 5px;
	}
	.one{
		
	}
	.two{
		
	}
	.three{
		
	}
	.four{
		
	}
	
</style>

flex布局---容器内部,align-self属性_第1张图片align-self属性允许单个项目有与其他项目不一样的对齐方式,可覆盖align-items属性。默认值为auto,表示继承父元素的align-items属性,如果没有父元素,则等同于stretch。

align-self:
 auto | flex-start | flex-end | center | baseline | stretch;
  .father{
		display: flex;
		justify-content: space-between;
		/* 容器东西底对齐 */
		align-items: flex-end;
	}
	.two{
		/* 第二个顶对齐 */
		align-self: flex-start;
	}

flex布局---容器内部,align-self属性_第2张图片

  .father{
		display: flex;
		justify-content: space-between;
		/* 容器东西顶对齐 */
		align-items: flex-start;
	}
	.two{
		/* 第二个底对齐 */
		align-self: flex-end;
	}

flex布局---容器内部,align-self属性_第3张图片

  .father{
		display: flex;
		justify-content: space-between;
		/* 容器东西顶对齐 */
		align-items: flex-start;
	}
	.two{
		/* 第二个居中对齐 */
		align-self: center;
	}

flex布局---容器内部,align-self属性_第4张图片

 .father{
		display: flex;
		justify-content: space-between;
		/* 容器东西顶对齐 */
		align-items: flex-start;
	}
	.two{
		/* 第二个居中对齐 */
		align-self: center;
	}

flex布局---容器内部,align-self属性_第5张图片

<style>
	.father{
		display: flex;
		justify-content: space-between;
		/* 容器东西顶对齐 */
		align-items: flex-start;
	}
	.son{
		width: 100px;
		height: 100px;
		background-color: #ff5500;
		border-radius: 5px;
	}
	.dauther{
		width: 50px;
		/* height: 50px; */
		background-color: #5500ff;
		border-radius: 5px;
	}
	.one{
		
	}
	.two{
		/* 第二个居中对齐 */
		align-self: stretch;
	}
	.three{
		
	}
	.four{
		
	}
</style>

flex布局---容器内部,align-self属性_第6张图片

你可能感兴趣的:(前端布局,javascript,前端,css)