Skip to content

Instantly share code, notes, and snippets.

@xsthunder
Last active November 4, 2020 01:47
Show Gist options
  • Save xsthunder/186281acfff33df8da5def263755ea93 to your computer and use it in GitHub Desktop.
Save xsthunder/186281acfff33df8da5def263755ea93 to your computer and use it in GitHub Desktop.
.container{
width: 500px;
display: flex;
flex-direction: column;
background: yellow;
}
.container-eachline{
display: flex;
flex-direction: row;
margin-top: 10px;
margin-bottom: 10px
}
.container-eachline div:first-child{
flex: 1;
}
.container-eachline div:first-child img{
float: right;
}
.container-eachline div:last-child{
flex: 1
}
img{
width:20px;
}
.title{
padding-left: 10px;
padding-right: 10px;
}
<div class="container">
<div class="container-eachline">
<div>
<img src="https://github.githubassets.com/images/spinners/octocat-spinner-128.gif"/>
</div>
<div class="title">
标题
</div>
<div>
<img src="https://github.githubassets.com/images/spinners/octocat-spinner-128.gif"/>
</div>
</div>
<div class="container-eachline">
<div>
<img src="https://github.githubassets.com/images/spinners/octocat-spinner-128.gif"/>
</div>
<div class="title">
标题标题
</div>
<div>
<img src="https://github.githubassets.com/images/spinners/octocat-spinner-128.gif"/>
</div>
</div>
<div class="container-eachline">
<div>
<img src="https://github.githubassets.com/images/spinners/octocat-spinner-128.gif"/>
</div>
<div class="title">
标题标题标题标题
</div>
<div>
<img src="https://github.githubassets.com/images/spinners/octocat-spinner-128.gif"/>
</div>
</div>
</div>
@xsthunder
Copy link
Author

xsthunder commented Nov 3, 2020

@xsthunder
Copy link
Author

效果
微信图片_20201103200403

@xsthunder
Copy link
Author

@xsthunder
Copy link
Author

参考行内垂直居中实践不行,因为img会在基线之上向上溢出

@xsthunder
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment