父元素使用display:flex
子元素:flex:1
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<style>
.flexBox{
display: flex;
}
.flexItem{
flex: 1;
}
</style>
</head>
<body>
<div class="flexBox">
<div class="flexItem">flex1</div>
<div class="flexItem">flex2</div>
<div class="flexItem">flex3</div>
</div>
</body>
</html>
网友评论