CSS 手机端常用信息列表
最终样式
HTML 代码
<div class="list"> <div class="item"> <img src="./1.png" > <div class="info"> <p class="title">这是标题,这是标题,这是标题,这是标题,这是标题</p> <p class="otherInfo"><span>张三</span><span>2021-02-02</span></p> </div> </div> </div>
CSS 代码
html,body{ background-color: #f8f9f1; } *{ margin: 0;padding: 0; } .list{ min-height: 500px; width: 94%; margin-left: 3%; padding-top: 20px; } .item{ background-color: #fff; display: flex; border-radius: 5px; margin-bottom: 15px; } .item>img{ width: 80px; height: 80px; margin: 10px; border-radius: 50%; overflow: hidden; } .item>.info{ display: flex; flex: 1; padding: 10px 10px 10px 0; flex-direction: column; justify-content: space-between; } .item>.info>.title{ text-overflow : ellipsis } .otherInfo{ display: flex; justify-content: space-between; }
记录一下,省的以后重新写