<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{margin: 0;padding: 0;}
.box{
display:flex;
width: 400px;
height: 200px;
background: pink;
align-items:center;
}
.box div{background: red;}
.box1{
align-self:auto;/*设置子元素在侧轴的对齐方式*/
/*align-self:stretch;*/
}
.box2{align-self:auto;}
</style>
</head>
<body>
<!--
align-self:;
auto 子元素跟随父元素 align-items的值
stretch 子元素被拉伸
-->
<div class="box">
<div class="box1">21</div>
<div class="box2">rr21</div>
</div>
</body>
</html>
CSS3弹性盒的anlign-self拉伸的效果
最新推荐文章于 2024-10-31 15:02:05 发布